Skip to content

Commit 928ef37

Browse files
committed
Replace most uses of pointer::offset with add and sub
1 parent 3a8ff61 commit 928ef37

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

example/alloc_system.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ mod platform {
156156
struct Header(*mut u8);
157157
const HEAP_ZERO_MEMORY: DWORD = 0x00000008;
158158
unsafe fn get_header<'a>(ptr: *mut u8) -> &'a mut Header {
159-
&mut *(ptr as *mut Header).offset(-1)
159+
&mut *(ptr as *mut Header).sub(1)
160160
}
161161
unsafe fn align_ptr(ptr: *mut u8, align: usize) -> *mut u8 {
162162
let aligned = ptr.add(align - (ptr as usize & (align - 1)));

0 commit comments

Comments
 (0)