WIP FPC-III support
[linux/fpc-iii.git] / arch / mips / boot / compressed / string.c
blob0b593b70922865888fad09d307affc0232bcd50b
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * arch/mips/boot/compressed/string.c
5 * Very small subset of simple string routines
6 */
8 #include <linux/compiler_attributes.h>
9 #include <linux/types.h>
11 void *memcpy(void *dest, const void *src, size_t n)
13 int i;
14 const char *s = src;
15 char *d = dest;
17 for (i = 0; i < n; i++)
18 d[i] = s[i];
19 return dest;
22 void *memset(void *s, int c, size_t n)
24 int i;
25 char *ss = s;
27 for (i = 0; i < n; i++)
28 ss[i] = c;
29 return s;
32 void * __weak memmove(void *dest, const void *src, size_t n)
34 unsigned int i;
35 const char *s = src;
36 char *d = dest;
38 if ((uintptr_t)dest < (uintptr_t)src) {
39 for (i = 0; i < n; i++)
40 d[i] = s[i];
41 } else {
42 for (i = n; i > 0; i--)
43 d[i - 1] = s[i - 1];
45 return dest;