From 9aa6e5750ef31d5ccc2c7edd184aaa3f7372ea00 Mon Sep 17 00:00:00 2001 From: Joshua Wise Date: Fri, 25 Nov 2011 02:42:09 -0500 Subject: [PATCH] ptr: Add mut_offset, to be able to calculate an offset on mutable pointers. --- src/lib/ptr.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/lib/ptr.rs b/src/lib/ptr.rs index 1654f9188a08..0372b17cdf1d 100644 --- a/src/lib/ptr.rs +++ b/src/lib/ptr.rs @@ -34,6 +34,16 @@ fn offset(ptr: *T, count: uint) -> *T { ret rusti::ptr_offset(ptr, count); } +/* +Function: mut_offset + +Calculate the offset from a mutable pointer +*/ +fn mut_offset(ptr: *mutable T, count: uint) -> *mutable T { + ret rusti::ptr_offset(ptr as *T, count) as *mutable T; +} + + /* Function: null