@@ -69,7 +69,7 @@ pub fn is_null<T>(ptr: *const T) -> bool { ptr == null() }
69
69
pub fn is_not_null < T > ( ptr : * const T ) -> bool { !is_null ( ptr) }
70
70
71
71
/**
72
- * Copies data from one location to another
72
+ * Copies data from one location to another.
73
73
*
74
74
* Copies `count` elements (not bytes) from `src` to `dst`. The source
75
75
* and destination may overlap.
@@ -83,7 +83,7 @@ pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
83
83
}
84
84
85
85
/**
86
- * Copies data from one location to another
86
+ * Copies data from one location to another.
87
87
*
88
88
* Copies `count` elements (not bytes) from `src` to `dst`. The source
89
89
* and destination may overlap.
@@ -95,6 +95,12 @@ pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
95
95
memmove32 ( dst, src as * T , count as u32 ) ;
96
96
}
97
97
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
+ */
98
104
#[ inline( always) ]
99
105
#[ cfg( target_word_size = "64" , stage0) ]
100
106
pub 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) {
104
110
}
105
111
106
112
/**
107
- * Copies data from one location to another
113
+ * Copies data from one location to another.
108
114
*
109
115
* Copies `count` elements (not bytes) from `src` to `dst`. The source
110
116
* and destination may overlap.
@@ -116,6 +122,12 @@ pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
116
122
memmove64 ( dst, src as * T , count as u64 ) ;
117
123
}
118
124
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
+ */
119
131
#[ inline( always) ]
120
132
#[ cfg( target_word_size = "32" , stage0) ]
121
133
pub 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
125
137
}
126
138
127
139
/**
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.
130
141
*
131
142
* Copies `count` elements (not bytes) from `src` to `dst`. The source
132
- * and destination may overlap.
143
+ * and destination may *not* overlap.
133
144
*/
134
145
#[ inline( always) ]
135
146
#[ 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
138
149
memcpy32 ( dst, src as * T , count as u32 ) ;
139
150
}
140
151
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
+ */
141
158
#[ inline( always) ]
142
159
#[ cfg( target_word_size = "64" , stage0) ]
143
160
pub 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
147
164
}
148
165
149
166
/**
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.
152
168
*
153
169
* Copies `count` elements (not bytes) from `src` to `dst`. The source
154
- * and destination may overlap.
170
+ * and destination may *not* overlap.
155
171
*/
156
172
#[ inline( always) ]
157
173
#[ 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
161
177
}
162
178
163
179
/**
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`.
166
182
*/
167
183
#[ inline( always) ]
168
184
#[ cfg( target_word_size = "32" , not( stage0) ) ]
@@ -172,8 +188,8 @@ pub unsafe fn set_memory<T>(dst: *mut T, c: u8, count: uint) {
172
188
}
173
189
174
190
/**
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`.
177
193
*/
178
194
#[ inline( always) ]
179
195
#[ cfg( target_word_size = "64" , not( stage0) ) ]
0 commit comments