diff options
| author | EmulatedSeasons <89668582+EmulatedSeasons@users.noreply.github.com> | 2024-01-07 03:19:28 -0500 |
|---|---|---|
| committer | EmulatedSeasons <89668582+EmulatedSeasons@users.noreply.github.com> | 2024-01-07 03:19:28 -0500 |
| commit | bb59107bd06a6a252b3743f17e55e3c17896db35 (patch) | |
| tree | cb8ad8bbd25fe7d5db6cf734c33f4777843876b9 /libs/libck/memmove.c | |
| parent | b7b97d32cbb6fbc928078ebe3a00714cbbebea86 (diff) | |
moved kernel libc stuff to libs/libck/
Diffstat (limited to 'libs/libck/memmove.c')
| -rw-r--r-- | libs/libck/memmove.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libs/libck/memmove.c b/libs/libck/memmove.c new file mode 100644 index 0000000..98c787f --- /dev/null +++ b/libs/libck/memmove.c @@ -0,0 +1,14 @@ +#include <string.h>
+
+void* memmove(void* dstptr, const void* srcptr, size_t size) {
+ unsigned char* dst = (unsigned char*) dstptr;
+ const unsigned char* src = (const unsigned char*) srcptr;
+ if (dst < src) {
+ for (size_t i = 0; i < size; i++)
+ dst[i] = src[i];
+ } else {
+ for (size_t i = size; i != 0; i--)
+ dst[i-1] = src[i-1];
+ }
+ return dstptr;
+}
\ No newline at end of file |
