| 212 | */ |
| 213 | #ifndef RT_KLIBC_USING_USER_MEMMOVE |
| 214 | void *rt_memmove(void *dest, const void *src, rt_size_t n) |
| 215 | { |
| 216 | #ifdef RT_KLIBC_USING_LIBC_MEMMOVE |
| 217 | return memmove(dest, src, n); |
| 218 | #else |
| 219 | char *tmp = (char *)dest, *s = (char *)src; |
| 220 | |
| 221 | if (s < tmp && tmp < s + n) |
| 222 | { |
| 223 | tmp += n; |
| 224 | s += n; |
| 225 | |
| 226 | while (n--) |
| 227 | *(--tmp) = *(--s); |
| 228 | } |
| 229 | else |
| 230 | { |
| 231 | while (n--) |
| 232 | *tmp++ = *s++; |
| 233 | } |
| 234 | |
| 235 | return dest; |
| 236 | #endif /* RT_KLIBC_USING_LIBC_MEMMOVE */ |
| 237 | } |
| 238 | #endif /* RT_KLIBC_USING_USER_MEMMOVE */ |
| 239 | RTM_EXPORT(rt_memmove); |
| 240 |
no outgoing calls
no test coverage detected