diff options
Diffstat (limited to 'Source/Library/Common/CMem.ns.cpp')
-rw-r--r-- | Source/Library/Common/CMem.ns.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Source/Library/Common/CMem.ns.cpp b/Source/Library/Common/CMem.ns.cpp index 37cdf0c..a4da4d2 100644 --- a/Source/Library/Common/CMem.ns.cpp +++ b/Source/Library/Common/CMem.ns.cpp @@ -3,9 +3,17 @@ namespace CMem { //Standard C functions -u8int *memcpy(u8int *dest, const u8int *src, int count) { - for (int i = 0; i < count; i++) { - dest[i] = src[i]; +u8int *memcpy(u8int *dest, const u8int *src, u32int count) { + u32int f = count % 4, n = count / 4; + const u32int* s = (u32int*)src; + u32int* d = (u32int*)dest; + for (u32int i = 0; i < n; i++) { + d[i] = s[i]; + } + if (f != 0) { + for (u32int i = count - f; i < count; i++) { + dest[i] = src[i]; + } } return dest; } |