summaryrefslogtreecommitdiffstats
path: root/lib/lz4.c
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2020-11-07 18:06:52 (GMT)
committerYann Collet <cyan@fb.com>2020-11-07 18:06:52 (GMT)
commitd4bfcf8489becbba084bceb0ddc74dc7c945cdde (patch)
tree3fad64eac25e80aaa9e0c7c8643c85182c61b600 /lib/lz4.c
parent80d3f32904ef447858aca2ecb7045805af23f8f6 (diff)
downloadlz4-d4bfcf8489becbba084bceb0ddc74dc7c945cdde.zip
lz4-d4bfcf8489becbba084bceb0ddc74dc7c945cdde.tar.gz
lz4-d4bfcf8489becbba084bceb0ddc74dc7c945cdde.tar.bz2
fix #935
minor: identical declaration and prototypes of `LZ4HC_compress_optimal()` also : very minor optimization of `LZ4_memcpy_using_offset()`
Diffstat (limited to 'lib/lz4.c')
-rw-r--r--lib/lz4.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index 9d547e5..e51fbd7 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -424,7 +424,9 @@ static const int dec64table[8] = {0, 0, 0, -1, -4, 1, 2, 3};
LZ4_FORCE_INLINE void
LZ4_memcpy_using_offset_base(BYTE* dstPtr, const BYTE* srcPtr, BYTE* dstEnd, const size_t offset)
{
+ assert(srcPtr + offset == dstPtr);
if (offset < 8) {
+ LZ4_write32(dstPtr, 0); /* silence an msan warning when offset==0 */
dstPtr[0] = srcPtr[0];
dstPtr[1] = srcPtr[1];
dstPtr[2] = srcPtr[2];
@@ -464,7 +466,6 @@ LZ4_memcpy_using_offset(BYTE* dstPtr, const BYTE* srcPtr, BYTE* dstEnd, const si
BYTE v[8];
assert(dstEnd >= dstPtr + MINMATCH);
- LZ4_write32(dstPtr, 0); /* silence an msan warning when offset==0 */
switch(offset) {
case 1:
@@ -473,7 +474,7 @@ LZ4_memcpy_using_offset(BYTE* dstPtr, const BYTE* srcPtr, BYTE* dstEnd, const si
case 2:
LZ4_memcpy(v, srcPtr, 2);
LZ4_memcpy(&v[2], srcPtr, 2);
- LZ4_memcpy(&v[4], &v[0], 4);
+ LZ4_memcpy(&v[4], v, 4);
break;
case 4:
LZ4_memcpy(v, srcPtr, 4);