Skip to content

Commit 0bc204e

Browse files
committed
rm unnecessary stage0 zero_memory fn
1 parent 0239a06 commit 0bc204e

File tree

1 file changed

+6
-28
lines changed

1 file changed

+6
-28
lines changed

src/libstd/ptr.rs

+6-28
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ pub fn is_not_null<T>(ptr: *const T) -> bool { !is_null(ptr) }
8080
#[inline]
8181
#[cfg(target_word_size = "32")]
8282
pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
83-
use unstable::intrinsics::memmove32;
84-
memmove32(dst, src as *T, count as u32);
83+
intrinsics::memmove32(dst, src as *T, count as u32);
8584
}
8685

8786
/**
@@ -93,8 +92,7 @@ pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
9392
#[inline]
9493
#[cfg(target_word_size = "64")]
9594
pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
96-
use unstable::intrinsics::memmove64;
97-
memmove64(dst, src as *T, count as u64);
95+
intrinsics::memmove64(dst, src as *T, count as u64);
9896
}
9997

10098
/**
@@ -106,8 +104,7 @@ pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) {
106104
#[inline]
107105
#[cfg(target_word_size = "32")]
108106
pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: uint) {
109-
use unstable::intrinsics::memcpy32;
110-
memcpy32(dst, src as *T, count as u32);
107+
intrinsics::memcpy32(dst, src as *T, count as u32);
111108
}
112109

113110
/**
@@ -119,8 +116,7 @@ pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: u
119116
#[inline]
120117
#[cfg(target_word_size = "64")]
121118
pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: uint) {
122-
use unstable::intrinsics::memcpy64;
123-
memcpy64(dst, src as *T, count as u64);
119+
intrinsics::memcpy64(dst, src as *T, count as u64);
124120
}
125121

126122
/**
@@ -130,8 +126,7 @@ pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: u
130126
#[inline]
131127
#[cfg(target_word_size = "32")]
132128
pub unsafe fn set_memory<T>(dst: *mut T, c: u8, count: uint) {
133-
use unstable::intrinsics::memset32;
134-
memset32(dst, c, count as u32);
129+
intrinsics::memset32(dst, c, count as u32);
135130
}
136131

137132
/**
@@ -141,34 +136,17 @@ pub unsafe fn set_memory<T>(dst: *mut T, c: u8, count: uint) {
141136
#[inline]
142137
#[cfg(target_word_size = "64")]
143138
pub unsafe fn set_memory<T>(dst: *mut T, c: u8, count: uint) {
144-
use unstable::intrinsics::memset64;
145-
memset64(dst, c, count as u64);
139+
intrinsics::memset64(dst, c, count as u64);
146140
}
147141

148142
/**
149143
* Zeroes out `count * size_of::<T>` bytes of memory at `dst`
150144
*/
151145
#[inline]
152-
#[cfg(not(stage0))]
153146
pub unsafe fn zero_memory<T>(dst: *mut T, count: uint) {
154147
set_memory(dst, 0, count);
155148
}
156149

157-
/**
158-
* Zeroes out `count * size_of::<T>` bytes of memory at `dst`
159-
*/
160-
#[inline]
161-
#[cfg(stage0)]
162-
pub unsafe fn zero_memory<T>(dst: *mut T, count: uint) {
163-
let mut count = count * sys::size_of::<T>();
164-
let mut dst = dst as *mut u8;
165-
while count > 0 {
166-
*dst = 0;
167-
dst = mut_offset(dst, 1);
168-
count -= 1;
169-
}
170-
}
171-
172150
/**
173151
* Swap the values at two mutable locations of the same type, without
174152
* deinitialising or copying either one.

0 commit comments

Comments
 (0)