Created
August 13, 2020 06:38
-
-
Save nixpulvis/eb6b3d7e78e82a7204740b3158d543d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
union U { | |
u32: u32, | |
u64: u64, | |
f32: f32, | |
f64: f64, | |
} | |
fn main() { | |
let u32 = U { u32: 1 }; | |
let u64 = U { u64: 1 }; | |
let f32 = U { f32: 1. }; | |
let f64 = U { f64: 1. }; | |
unsafe { | |
dbg!(u32.u32); | |
dbg!(u32.u64); | |
dbg!(u32.f32); | |
dbg!(u32.f64); | |
dbg!(u64.u32); | |
dbg!(u64.u64); | |
dbg!(u64.f32); | |
dbg!(u64.f64); | |
dbg!(f32.u32); | |
dbg!(f32.u64); | |
dbg!(f32.f32); | |
dbg!(f32.f64); | |
dbg!(f64.u32); | |
dbg!(f64.u64); | |
dbg!(f64.f32); | |
dbg!(f64.f64); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment