2 ms·
In case anyone wants to try the same, my assumption is that they specified `#[repr(packed(8))]` on some structs to use alignments and paddings of at most 8 byte
by wongarsu 3y ago
In case anyone wants to try the same, my assumption is that they specified `#[repr(packed(8))]` on some structs to use alignments and paddings of at most 8 bytes. Using `[repr(align(8))]` on the field should also work, if you want more fine-grained control.
https://doc.rust-lang.org/reference/type-layout.html#the-alignment-modifiers https://doc.rust-lang.org/reference/type-layout.html#the-ali...
- thayne 3y ago> my assumption is that they specified `#[repr(packed(8))]` on some structs to use alignments and paddings of at most 8 bytes That would mean taking a reference of any field of that struct is undefined behavior, unless the compiler does some special magic for this specific case. > Using `[repr(align(8))]` on the field I don't think you can do that directly. You would need to use a newtype that specified the alignment, and use that type for the field.