@@ -69,7 +69,7 @@ pub fn is_null<T>(ptr: *const T) -> bool { ptr == null() }
6969pub fn is_not_null < T > ( ptr : * const T ) -> bool { !is_null ( ptr) }
7070
7171/**
72- * Copies data from one location to another
72+ * Copies data from one location to another.
7373 *
7474 * Copies `count` elements (not bytes) from `src` to `dst`. The source
7575 * and destination may overlap.
@@ -83,7 +83,7 @@ pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
8383}
8484
8585/**
86- * Copies data from one location to another
86+ * Copies data from one location to another.
8787 *
8888 * Copies `count` elements (not bytes) from `src` to `dst`. The source
8989 * and destination may overlap.
@@ -95,6 +95,12 @@ pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
9595 memmove32 ( dst, src as * T , count as u32 ) ;
9696}
9797
98+ /**
99+ * Copies data from one location to another.
100+ *
101+ * Copies `count` elements (not bytes) from `src` to `dst`. The source
102+ * and destination may overlap.
103+ */
98104#[ inline( always) ]
99105#[ cfg( target_word_size = "64" , stage0) ]
100106pub unsafe fn copy_memory < T > ( dst : * mut T , src : * const T , count : uint ) {
@@ -104,7 +110,7 @@ pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
104110}
105111
106112/**
107- * Copies data from one location to another
113+ * Copies data from one location to another.
108114 *
109115 * Copies `count` elements (not bytes) from `src` to `dst`. The source
110116 * and destination may overlap.
@@ -116,6 +122,12 @@ pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
116122 memmove64 ( dst, src as * T , count as u64 ) ;
117123}
118124
125+ /**
126+ * Copies data from one location to another.
127+ *
128+ * Copies `count` elements (not bytes) from `src` to `dst`. The source
129+ * and destination may *not* overlap.
130+ */
119131#[ inline( always) ]
120132#[ cfg( target_word_size = "32" , stage0) ]
121133pub unsafe fn copy_nonoverlapping_memory < T > ( dst : * mut T , src : * const T , count : uint ) {
@@ -125,11 +137,10 @@ pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: u
125137}
126138
127139/**
128- * Copies data from one location to another. This uses memcpy instead of memmove
129- * to take advantage of the knowledge that the memory does not overlap.
140+ * Copies data from one location to another.
130141 *
131142 * Copies `count` elements (not bytes) from `src` to `dst`. The source
132- * and destination may overlap.
143+ * and destination may *not* overlap.
133144 */
134145#[ inline( always) ]
135146#[ cfg( target_word_size = "32" , not( stage0) ) ]
@@ -138,6 +149,12 @@ pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: u
138149 memcpy32 ( dst, src as * T , count as u32 ) ;
139150}
140151
152+ /**
153+ * Copies data from one location to another.
154+ *
155+ * Copies `count` elements (not bytes) from `src` to `dst`. The source
156+ * and destination may *not* overlap.
157+ */
141158#[ inline( always) ]
142159#[ cfg( target_word_size = "64" , stage0) ]
143160pub unsafe fn copy_nonoverlapping_memory < T > ( dst : * mut T , src : * const T , count : uint ) {
@@ -147,11 +164,10 @@ pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: u
147164}
148165
149166/**
150- * Copies data from one location to another. This uses memcpy instead of memmove
151- * to take advantage of the knowledge that the memory does not overlap.
167+ * Copies data from one location to another.
152168 *
153169 * Copies `count` elements (not bytes) from `src` to `dst`. The source
154- * and destination may overlap.
170+ * and destination may *not* overlap.
155171 */
156172#[ inline( always) ]
157173#[ cfg( target_word_size = "64" , not( stage0) ) ]
@@ -161,8 +177,8 @@ pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: u
161177}
162178
163179/**
164- * Invokes memset on the specified pointer, setting `count` bytes of memory
165- * starting at `dst` to `c`.
180+ * Invokes memset on the specified pointer, setting `count * size_of::<T>()`
181+ * bytes of memory starting at `dst` to `c`.
166182 */
167183#[ inline( always) ]
168184#[ cfg( target_word_size = "32" , not( stage0) ) ]
@@ -172,8 +188,8 @@ pub unsafe fn set_memory<T>(dst: *mut T, c: u8, count: uint) {
172188}
173189
174190/**
175- * Invokes memset on the specified pointer, setting `count` bytes of memory
176- * starting at `dst` to `c`.
191+ * Invokes memset on the specified pointer, setting `count * size_of::<T>()`
192+ * bytes of memory starting at `dst` to `c`.
177193 */
178194#[ inline( always) ]
179195#[ cfg( target_word_size = "64" , not( stage0) ) ]
0 commit comments