MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_memmove

Function rt_memmove

src/klibc/kstring.c:214–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212 */
213#ifndef RT_KLIBC_USING_USER_MEMMOVE
214void *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 */
239RTM_EXPORT(rt_memmove);
240

Callers 13

finsh_thread_entryFunction · 0.85
ifFunction · 0.85
rt_hw_common_setupFunction · 0.85
TC_rt_memmove_basicFunction · 0.85
TC_rt_memmove_null_srcFunction · 0.85
TC_rt_memmove_null_destFunction · 0.85
TC_rt_memmove_too_longFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected