ntapi icon indicating copy to clipboard operation
ntapi copied to clipboard

Fix temporary references for volatile read

Open bdbai opened this issue 3 years ago • 0 comments

Taking a reference to an unaligned field is an undefined behavior, even if it is converted to a pointer immediately. Although the memory access here must be aligned given the fixed base address and the offset of the field, rustc still issue a warning due to the struct being 4 packed. Here we can use core::ptr::addr_of to create a pointer to a field without introducing a reference.

Fixes #11.

bdbai avatar Aug 07 '22 08:08 bdbai