diff options
Diffstat (limited to 'src/memory/memory.c')
-rw-r--r-- | src/memory/memory.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/memory/memory.c b/src/memory/memory.c index 3524787..f36c0bc 100644 --- a/src/memory/memory.c +++ b/src/memory/memory.c @@ -1,16 +1,14 @@ #include "../graphics/vga.h" -unsigned char *memory_copy(unsigned char *dest, const unsigned char *src, int count) { - // TODO: Add memory copy function +void *memory_copy(void *dest, const void *src, size_t count) { + const char *sp = (const char *) src; + char *dp = (char *) dest; + for (; count != 0; count--) *dp++ = *sp++; + return dest; } -unsigned char *memory_set(unsigned char *dest, unsigned char val, int count) { - unsigned char *p = dest; - while (count > 0) { - if (!*p) break; - *p = val; - p++; - count--; - } +void *memory_set(void *dest, char val, size_t count) { + char *temp = (char *) dest; + for (; count != 0; count--) *temp++ = val; return dest; } |