[codec,xcrush] follow up to #8529
There was still an issue left, if diff == 0 then the loop counter did never increment. Skip this case now completely as the memory does not need to be copied anyway.
This commit is contained in:
parent
2b49047c34
commit
d399c1c6fb
@ -759,12 +759,12 @@ static INLINE size_t xcrush_copy_bytes(BYTE* dst, const BYTE* src, size_t num)
|
||||
|
||||
if (src + num < dst || src > dst + num)
|
||||
memcpy(dst, src, num);
|
||||
else
|
||||
else if (src != dst)
|
||||
{
|
||||
// src and dst overlaps
|
||||
// we should copy the area that doesn't overlap repeatly
|
||||
const size_t diff = (dst > src) ? dst - src : src - dst;
|
||||
const size_t rest = (diff > 0) ? num % diff : 0;
|
||||
const size_t rest = num % diff;
|
||||
const size_t end = num - rest;
|
||||
|
||||
for (size_t a = 0; a < end; a += diff)
|
||||
|
Loading…
Reference in New Issue
Block a user