Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- fn our_to_u32(n: i32) -> u32 {
- let n = (n << 1) as u32;
- n >> 1
- }
- println!("{}", our_to_u32(i32::min_value()));
- println!("{}", our_to_u32(i32::max_value()));
- assert_eq!(u32::max_value(), our_to_u32(i32::max_value()));
- assert_eq!(0, our_to_u32(i32::min_value()));
- println!("{}", our_to_u32(1));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement