diff options
author | mrb0nk500 <b0nk@b0nk.xyz> | 2023-02-08 19:42:29 -0400 |
---|---|---|
committer | mrb0nk500 <b0nk@b0nk.xyz> | 2023-02-08 19:42:29 -0400 |
commit | f6f02a456b92de6bdafb80d0bf428044f8217a75 (patch) | |
tree | 3de7828ac9a19ad84cf01eb894de8b7aae7f08c9 /src | |
parent | 22da46864392cfe6a43ec67c319cd9b1fcc079bd (diff) |
make, runtime: Start putting files, and functions in the right order
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); } |