File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -21,14 +21,18 @@ use util::swap;
2121
2222#[ cfg( not( test) ) ] use cmp:: { Eq , Ord } ;
2323
24- /// Calculate the offset from a pointer
24+ /// Calculate the offset from a pointer.
25+ /// The `count` argument is in units of T; e.g. a `count` of 3
26+ /// represents a pointer offset of `3 * sizeof::<T>()` bytes.
2527#[ inline]
2628pub unsafe fn offset < T > ( ptr : * T , count : int ) -> * T {
2729 intrinsics:: offset ( ptr, count)
2830}
2931
3032/// Calculate the offset from a mut pointer. The count *must* be in bounds or
3133/// otherwise the loads of this address are undefined.
34+ /// The `count` argument is in units of T; e.g. a `count` of 3
35+ /// represents a pointer offset of `3 * sizeof::<T>()` bytes.
3236#[ inline]
3337pub unsafe fn mut_offset < T > ( ptr : * mut T , count : int ) -> * mut T {
3438 intrinsics:: offset ( ptr as * T , count) as * mut T
You can’t perform that action at this time.
0 commit comments