diff options
| author | Emu <89668582+EmulatedSeasons@users.noreply.github.com> | 2024-05-31 23:38:46 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-31 23:38:46 -0400 |
| commit | 27a44e0d79d1c6e01cd832feb8ad958d5999b5e3 (patch) | |
| tree | 3759eb02fcad7a609a064080d81b7c6f9dbec4c8 /libc/memmove.c | |
| parent | 639240bbf498195912d8ceb6cb396b89391a5b1b (diff) | |
| parent | fd5a1699592ce0afafc42ebf22401596abcdfc28 (diff) | |
Merge pull request #1 from EmulatedSeasons/limineswitch
Limineswitch
Diffstat (limited to 'libc/memmove.c')
| -rw-r--r-- | libc/memmove.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libc/memmove.c b/libc/memmove.c new file mode 100644 index 0000000..98c787f --- /dev/null +++ b/libc/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 |
