removed LZ4_copy8

better use memcpy() directly
This commit is contained in:
Yann Collet 2018-02-11 22:20:09 -08:00
parent 3ad3b0f850
commit 219abab74b

View File

@ -270,11 +270,6 @@ static void LZ4_writeLE16(void* memPtr, U16 value)
}
}
static void LZ4_copy8(void* dst, const void* src)
{
memcpy(dst,src,8);
}
/* customized variant of memcpy, which can overwrite up to 8 bytes beyond dstEnd */
LZ4_FORCE_O2_INLINE_GCC_PPC64LE
void LZ4_wildCopy(void* dstPtr, const void* srcPtr, void* dstEnd)
@ -283,7 +278,7 @@ void LZ4_wildCopy(void* dstPtr, const void* srcPtr, void* dstEnd)
const BYTE* s = (const BYTE*)srcPtr;
BYTE* const e = (BYTE*)dstEnd;
do { LZ4_copy8(d,s); d+=8; s+=8; } while (d<e);
do { memcpy(d,s,8); d+=8; s+=8; } while (d<e);
}
@ -1223,9 +1218,9 @@ LZ4_FORCE_INLINE int LZ4_decompress_generic(
if ((off >= 8) /* do not deal with overlapping matches */ & (matchPtr >= lowPrefix)) {
size_t const ml = (token & ML_MASK) + MINMATCH;
memcpy(op, ip, 16); op += ll; ip += ll + 2 /*offset*/;
memcpy(op+ 0, matchPtr+ 0, 8);
memcpy(op+ 8, matchPtr+ 8, 8);
memcpy(op+16, matchPtr+16, 2);
memcpy(op + 0, matchPtr + 0, 8);
memcpy(op + 8, matchPtr + 8, 8);
memcpy(op +16, matchPtr +16, 2);
op += ml;
continue;
}
@ -1316,7 +1311,7 @@ LZ4_FORCE_INLINE int LZ4_decompress_generic(
match += inc32table[offset];
memcpy(op+4, match, 4);
match -= dec64table[offset];
} else { LZ4_copy8(op, match); match+=8; }
} else { memcpy(op, match, 8); match+=8; }
op += 8;
if (unlikely(cpy>oend-12)) {
@ -1329,7 +1324,7 @@ LZ4_FORCE_INLINE int LZ4_decompress_generic(
}
while (op<cpy) *op++ = *match++;
} else {
LZ4_copy8(op, match);
memcpy(op, match, 8);
if (length>16) LZ4_wildCopy(op+8, match+8, cpy);
}
op = cpy; /* correction */