diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Runtime/__mem.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/Runtime/__mem.c b/src/Runtime/__mem.c index a5ef6c1..84703b7 100644 --- a/src/Runtime/__mem.c +++ b/src/Runtime/__mem.c @@ -1,20 +1,8 @@ #include "string.h" -void* memcpy(void* dst, const void* src, size_t n) { - const char* p; - char* q; - int rev = ((unsigned long)src < (unsigned long)dst); - - if (!rev) { - - for (p = (const char*)src - 1, q = (char*)dst - 1, n++; --n;) - *++q = *++p; - - } else { - for (p = (const char*)src + n, q = (char*)dst + n, n++; --n;) - *--q = *--p; - } - return (dst); +void* memset(void* str, int c, size_t n) { + __fill_mem(str, c, n); + return str; } #define cps ((unsigned char*)src) @@ -79,7 +67,19 @@ void __fill_mem(void* dst, int val, size_t n) { return; } -void* memset(void* str, int c, size_t n) { - __fill_mem(str, c, n); - return str; +void* memcpy(void* dst, const void* src, size_t n) { + const char* p; + char* q; + int rev = ((unsigned long)src < (unsigned long)dst); + + if (!rev) { + + for (p = (const char*)src - 1, q = (char*)dst - 1, n++; --n;) + *++q = *++p; + + } else { + for (p = (const char*)src + n, q = (char*)dst + n, n++; --n;) + *--q = *--p; + } + return (dst); } |