fix rt_memcpy buf in RT_USING_TINY_SIZE enable
This commit is contained in:
parent
300888082a
commit
f6b71172b5
|
@ -220,9 +220,18 @@ void *rt_memcpy(void *dst, const void *src, rt_ubase_t count)
|
||||||
{
|
{
|
||||||
#ifdef RT_USING_TINY_SIZE
|
#ifdef RT_USING_TINY_SIZE
|
||||||
char *tmp = (char *)dst, *s = (char *)src;
|
char *tmp = (char *)dst, *s = (char *)src;
|
||||||
|
rt_ubase_t len;
|
||||||
|
|
||||||
|
if(tmp <= s || tmp > (s + count))
|
||||||
|
{
|
||||||
while (count--)
|
while (count--)
|
||||||
*tmp ++ = *s ++;
|
*tmp ++ = *s ++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for(len = count; len > 0; len --)
|
||||||
|
tmp[len -1] = s[len - 1];
|
||||||
|
}
|
||||||
|
|
||||||
return dst;
|
return dst;
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue