-
I would like to use this crate with |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Since a type's size is always a multiple of its alignment, then if the value is aligned to 16 but the fields are only a total of 12 bytes (say a |
Beta Was this translation helpful? Give feedback.
Since a type's size is always a multiple of its alignment, then if the value is aligned to 16 but the fields are only a total of 12 bytes (say a
vec3
), then there will be 4 bytes of padding inserted to bring the type's size to a multiple of 16 (in this case16*1
). If you transmute that value into a byte array ([u8; 16]
) array, then the first 12 bytes would be initialized and the last 4 bytes would be unitialized. In Rust you aren't allowed to convert uninitialized memory into normal data types (you have to useMaybeUninit
).