Skip to content

Commit

Permalink
Replace most uses of pointer::offset with add and sub
Browse files Browse the repository at this point in the history
  • Loading branch information
WaffleLapkin committed Aug 20, 2022
1 parent 1cde1a3 commit bd1ab72
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion example/alloc_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ mod platform {
struct Header(*mut u8);
const HEAP_ZERO_MEMORY: DWORD = 0x00000008;
unsafe fn get_header<'a>(ptr: *mut u8) -> &'a mut Header {
&mut *(ptr as *mut Header).offset(-1)
&mut *(ptr as *mut Header).sub(1)
}
unsafe fn align_ptr(ptr: *mut u8, align: usize) -> *mut u8 {
let aligned = ptr.add(align - (ptr as usize & (align - 1)));
Expand Down

0 comments on commit bd1ab72

Please sign in to comment.