about summary refs log tree commit diff
path: root/src/liballoc_system
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-08-21 22:05:30 +0800
committerkennytm <kennytm@gmail.com>2018-08-21 22:05:30 +0800
commit0dd88c97975b2a2e4ea3e4a2bdc3670a9f40bd67 (patch)
tree0ad62b121fcafe2d11ee95819caf64e975d4ad00 /src/liballoc_system
parent9bbab65ebefbeb512445a759603b03f858e5e9b9 (diff)
parent993fb934640b7e514f3c629c33a2698a83ed8c3e (diff)
downloadrust-0dd88c97975b2a2e4ea3e4a2bdc3670a9f40bd67.tar.gz
rust-0dd88c97975b2a2e4ea3e4a2bdc3670a9f40bd67.zip
Rollup merge of #53329 - frewsxcv:frewsxcv-ptr-add-sub, r=RalfJung
Replace usages of ptr::offset with ptr::{add,sub}.

Rust provides these helper methods – so let's use them!
Diffstat (limited to 'src/liballoc_system')
-rw-r--r--src/liballoc_system/lib.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/liballoc_system/lib.rs b/src/liballoc_system/lib.rs
index c5e056f6b12..753b6a5e292 100644
--- a/src/liballoc_system/lib.rs
+++ b/src/liballoc_system/lib.rs
@@ -249,7 +249,7 @@ mod platform {
     }
 
     unsafe fn align_ptr(ptr: *mut u8, align: usize) -> *mut u8 {
-        let aligned = ptr.offset((align - (ptr as usize & (align - 1))) as isize);
+        let aligned = ptr.add(align - (ptr as usize & (align - 1)));
         *get_header(aligned) = Header(ptr);
         aligned
     }