From 107e371bf063bc7e67698814ce87fe6cbf920d9d Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Tue, 11 Jun 2013 17:48:44 -0400 Subject: [PATCH 1/2] fix the ptr::set_memory docstring --- src/libstd/ptr.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libstd/ptr.rs b/src/libstd/ptr.rs index e2cbf716dd1f6..59e588ef53389 100644 --- a/src/libstd/ptr.rs +++ b/src/libstd/ptr.rs @@ -161,8 +161,8 @@ pub unsafe fn copy_nonoverlapping_memory(dst: *mut T, src: *const T, count: u } /** - * Invokes memset on the specified pointer, setting `count` bytes of memory - * starting at `dst` to `c`. + * Invokes memset on the specified pointer, setting `count * size_of::()` + * bytes of memory starting at `dst` to `c`. */ #[inline(always)] #[cfg(target_word_size = "32", not(stage0))] @@ -172,8 +172,8 @@ pub unsafe fn set_memory(dst: *mut T, c: u8, count: uint) { } /** - * Invokes memset on the specified pointer, setting `count` bytes of memory - * starting at `dst` to `c`. + * Invokes memset on the specified pointer, setting `count * size_of::()` + * bytes of memory starting at `dst` to `c`. */ #[inline(always)] #[cfg(target_word_size = "64", not(stage0))] From fbae011ad17fb4986a861c5358a5a274892397dd Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Tue, 11 Jun 2013 19:06:01 -0400 Subject: [PATCH 2/2] fix the docstring for copy_nonoverlapping_memory --- src/libstd/ptr.rs | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/src/libstd/ptr.rs b/src/libstd/ptr.rs index 59e588ef53389..cd5a3182f6b87 100644 --- a/src/libstd/ptr.rs +++ b/src/libstd/ptr.rs @@ -69,7 +69,7 @@ pub fn is_null(ptr: *const T) -> bool { ptr == null() } pub fn is_not_null(ptr: *const T) -> bool { !is_null(ptr) } /** - * Copies data from one location to another + * Copies data from one location to another. * * Copies `count` elements (not bytes) from `src` to `dst`. The source * and destination may overlap. @@ -83,7 +83,7 @@ pub unsafe fn copy_memory(dst: *mut T, src: *const T, count: uint) { } /** - * Copies data from one location to another + * Copies data from one location to another. * * Copies `count` elements (not bytes) from `src` to `dst`. The source * and destination may overlap. @@ -95,6 +95,12 @@ pub unsafe fn copy_memory(dst: *mut T, src: *const T, count: uint) { memmove32(dst, src as *T, count as u32); } +/** + * Copies data from one location to another. + * + * Copies `count` elements (not bytes) from `src` to `dst`. The source + * and destination may overlap. + */ #[inline(always)] #[cfg(target_word_size = "64", stage0)] pub unsafe fn copy_memory(dst: *mut T, src: *const T, count: uint) { @@ -104,7 +110,7 @@ pub unsafe fn copy_memory(dst: *mut T, src: *const T, count: uint) { } /** - * Copies data from one location to another + * Copies data from one location to another. * * Copies `count` elements (not bytes) from `src` to `dst`. The source * and destination may overlap. @@ -116,6 +122,12 @@ pub unsafe fn copy_memory(dst: *mut T, src: *const T, count: uint) { memmove64(dst, src as *T, count as u64); } +/** + * Copies data from one location to another. + * + * Copies `count` elements (not bytes) from `src` to `dst`. The source + * and destination may *not* overlap. + */ #[inline(always)] #[cfg(target_word_size = "32", stage0)] pub unsafe fn copy_nonoverlapping_memory(dst: *mut T, src: *const T, count: uint) { @@ -125,11 +137,10 @@ pub unsafe fn copy_nonoverlapping_memory(dst: *mut T, src: *const T, count: u } /** - * Copies data from one location to another. This uses memcpy instead of memmove - * to take advantage of the knowledge that the memory does not overlap. + * Copies data from one location to another. * * Copies `count` elements (not bytes) from `src` to `dst`. The source - * and destination may overlap. + * and destination may *not* overlap. */ #[inline(always)] #[cfg(target_word_size = "32", not(stage0))] @@ -138,6 +149,12 @@ pub unsafe fn copy_nonoverlapping_memory(dst: *mut T, src: *const T, count: u memcpy32(dst, src as *T, count as u32); } +/** + * Copies data from one location to another. + * + * Copies `count` elements (not bytes) from `src` to `dst`. The source + * and destination may *not* overlap. + */ #[inline(always)] #[cfg(target_word_size = "64", stage0)] pub unsafe fn copy_nonoverlapping_memory(dst: *mut T, src: *const T, count: uint) { @@ -147,11 +164,10 @@ pub unsafe fn copy_nonoverlapping_memory(dst: *mut T, src: *const T, count: u } /** - * Copies data from one location to another. This uses memcpy instead of memmove - * to take advantage of the knowledge that the memory does not overlap. + * Copies data from one location to another. * * Copies `count` elements (not bytes) from `src` to `dst`. The source - * and destination may overlap. + * and destination may *not* overlap. */ #[inline(always)] #[cfg(target_word_size = "64", not(stage0))]