Skip to content

Commit bd1ab72

Browse files
committed
Replace most uses of pointer::offset with add and sub
1 parent 1cde1a3 commit bd1ab72

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: example/alloc_system.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ mod platform {
9494
struct Header(*mut u8);
9595
const HEAP_ZERO_MEMORY: DWORD = 0x00000008;
9696
unsafe fn get_header<'a>(ptr: *mut u8) -> &'a mut Header {
97-
&mut *(ptr as *mut Header).offset(-1)
97+
&mut *(ptr as *mut Header).sub(1)
9898
}
9999
unsafe fn align_ptr(ptr: *mut u8, align: usize) -> *mut u8 {
100100
let aligned = ptr.add(align - (ptr as usize & (align - 1)));

0 commit comments

Comments
 (0)