diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2013-07-17 14:04:33 -0400 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2013-07-17 14:08:54 -0400 |
| commit | 0bc204e74d260f24e1458de08032c8631ae85a11 (patch) | |
| tree | 93f236545e49512fe1ddf900810f6afffed5fd38 /src/libstd | |
| parent | 0239a06a6401d789a70c0089ada071ca981874df (diff) | |
| download | rust-0bc204e74d260f24e1458de08032c8631ae85a11.tar.gz rust-0bc204e74d260f24e1458de08032c8631ae85a11.zip | |
rm unnecessary stage0 `zero_memory` fn
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/ptr.rs | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/src/libstd/ptr.rs b/src/libstd/ptr.rs index e1a62b26bbf..3f7a857e382 100644 --- a/src/libstd/ptr.rs +++ b/src/libstd/ptr.rs @@ -80,8 +80,7 @@ pub fn is_not_null<T>(ptr: *const T) -> bool { !is_null(ptr) } #[inline] #[cfg(target_word_size = "32")] pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) { - use unstable::intrinsics::memmove32; - memmove32(dst, src as *T, count as u32); + intrinsics::memmove32(dst, src as *T, count as u32); } /** @@ -93,8 +92,7 @@ pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) { #[inline] #[cfg(target_word_size = "64")] pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) { - use unstable::intrinsics::memmove64; - memmove64(dst, src as *T, count as u64); + intrinsics::memmove64(dst, src as *T, count as u64); } /** @@ -106,8 +104,7 @@ pub unsafe fn copy_memory<T>(dst: *mut T, src: *const T, count: uint) { #[inline] #[cfg(target_word_size = "32")] pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: uint) { - use unstable::intrinsics::memcpy32; - memcpy32(dst, src as *T, count as u32); + intrinsics::memcpy32(dst, src as *T, count as u32); } /** @@ -119,8 +116,7 @@ pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: u #[inline] #[cfg(target_word_size = "64")] pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: uint) { - use unstable::intrinsics::memcpy64; - memcpy64(dst, src as *T, count as u64); + intrinsics::memcpy64(dst, src as *T, count as u64); } /** @@ -130,8 +126,7 @@ pub unsafe fn copy_nonoverlapping_memory<T>(dst: *mut T, src: *const T, count: u #[inline] #[cfg(target_word_size = "32")] pub unsafe fn set_memory<T>(dst: *mut T, c: u8, count: uint) { - use unstable::intrinsics::memset32; - memset32(dst, c, count as u32); + intrinsics::memset32(dst, c, count as u32); } /** @@ -141,35 +136,18 @@ pub unsafe fn set_memory<T>(dst: *mut T, c: u8, count: uint) { #[inline] #[cfg(target_word_size = "64")] pub unsafe fn set_memory<T>(dst: *mut T, c: u8, count: uint) { - use unstable::intrinsics::memset64; - memset64(dst, c, count as u64); + intrinsics::memset64(dst, c, count as u64); } /** * Zeroes out `count * size_of::<T>` bytes of memory at `dst` */ #[inline] -#[cfg(not(stage0))] pub unsafe fn zero_memory<T>(dst: *mut T, count: uint) { set_memory(dst, 0, count); } /** - * Zeroes out `count * size_of::<T>` bytes of memory at `dst` - */ -#[inline] -#[cfg(stage0)] -pub unsafe fn zero_memory<T>(dst: *mut T, count: uint) { - let mut count = count * sys::size_of::<T>(); - let mut dst = dst as *mut u8; - while count > 0 { - *dst = 0; - dst = mut_offset(dst, 1); - count -= 1; - } -} - -/** * Swap the values at two mutable locations of the same type, without * deinitialising or copying either one. */ |
