.. | .. |
---|
5 | 5 | * Very small subset of simple string routines |
---|
6 | 6 | */ |
---|
7 | 7 | |
---|
| 8 | +#include <linux/compiler_attributes.h> |
---|
8 | 9 | #include <linux/types.h> |
---|
9 | 10 | |
---|
10 | 11 | void *memcpy(void *dest, const void *src, size_t n) |
---|
.. | .. |
---|
27 | 28 | ss[i] = c; |
---|
28 | 29 | return s; |
---|
29 | 30 | } |
---|
| 31 | + |
---|
| 32 | +void * __weak memmove(void *dest, const void *src, size_t n) |
---|
| 33 | +{ |
---|
| 34 | + unsigned int i; |
---|
| 35 | + const char *s = src; |
---|
| 36 | + char *d = dest; |
---|
| 37 | + |
---|
| 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]; |
---|
| 44 | + } |
---|
| 45 | + return dest; |
---|
| 46 | +} |
---|