Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. fn main() {
  2. fn our_to_u32(n: i32) -> u32 {
  3. let n = (n << 1) as u32;
  4. n >> 1
  5. }
  6.  
  7. println!("{}", our_to_u32(i32::min_value()));
  8. println!("{}", our_to_u32(i32::max_value()));
  9. assert_eq!(u32::max_value(), our_to_u32(i32::max_value()));
  10. assert_eq!(0, our_to_u32(i32::min_value()));
  11. println!("{}", our_to_u32(1));
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement