File tree 1 file changed +5
-1
lines changed
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -21,14 +21,18 @@ use util::swap;
21
21
22
22
#[ cfg( not( test) ) ] use cmp:: { Eq , Ord } ;
23
23
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.
25
27
#[ inline]
26
28
pub unsafe fn offset < T > ( ptr : * T , count : int ) -> * T {
27
29
intrinsics:: offset ( ptr, count)
28
30
}
29
31
30
32
/// Calculate the offset from a mut pointer. The count *must* be in bounds or
31
33
/// 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.
32
36
#[ inline]
33
37
pub unsafe fn mut_offset < T > ( ptr : * mut T , count : int ) -> * mut T {
34
38
intrinsics:: offset ( ptr as * T , count) as * mut T
You can’t perform that action at this time.
0 commit comments