mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-23 02:27:39 +03:00
added some documentation and made the memcpy and memmove unsafe
This commit is contained in:
committed by
Brian Anderson
parent
3e9859362b
commit
a5fc0b08de
+4
-2
@@ -57,15 +57,17 @@ fn mut_offset<T>(ptr: *mutable T, count: uint) -> *mutable T {
|
||||
Function: memcpy
|
||||
|
||||
Copies data from one src to dst that is not overlapping each other.
|
||||
Count is the number of elements to copy and not the number of bytes.
|
||||
*/
|
||||
fn memcpy<T>(dst: *T, src: *T, count: uint) unsafe { rusti::memcpy(dst, src, count); }
|
||||
unsafe fn memcpy<T>(dst: *T, src: *T, count: uint) { rusti::memcpy(dst, src, count); }
|
||||
|
||||
/*
|
||||
Function: memmove
|
||||
|
||||
Copies data from one src to dst, overlap between the two pointers may occur.
|
||||
Count is the number of elements to copy and not the number of bytes.
|
||||
*/
|
||||
fn memmove<T>(dst: *T, src: *T, count: uint) unsafe { rusti::memcpy(dst, src, count); }
|
||||
unsafe fn memmove<T>(dst: *T, src: *T, count: uint) { rusti::memcpy(dst, src, count); }
|
||||
|
||||
#[test]
|
||||
fn test() unsafe {
|
||||
|
||||
Reference in New Issue
Block a user