ptr: Add mut_offset, to be able to calculate an offset on mutable pointers.

This commit is contained in:
Joshua Wise 2011-11-25 02:42:09 -05:00 committed by Niko Matsakis
parent 020d8f12a0
commit 9aa6e5750e
1 changed files with 10 additions and 0 deletions

View File

@ -34,6 +34,16 @@ fn offset<T>(ptr: *T, count: uint) -> *T {
ret rusti::ptr_offset(ptr, count);
}
/*
Function: mut_offset
Calculate the offset from a mutable pointer
*/
fn mut_offset<T>(ptr: *mutable T, count: uint) -> *mutable T {
ret rusti::ptr_offset(ptr as *T, count) as *mutable T;
}
/*
Function: null