summaryrefslogtreecommitdiffstats
path: root/lib/lz4hc.c
diff options
context:
space:
mode:
authorW. Felix Handte <w@felixhandte.com>2018-04-05 20:32:40 (GMT)
committerW. Felix Handte <w@felixhandte.com>2018-04-20 00:54:35 (GMT)
commit221211d7d04478d74eec9fd76ccd98a73bd394ee (patch)
treeb8cb07e0ddfaa0a53eb854a5fc8675fc9ecf07d0 /lib/lz4hc.c
parenta1beba13f7363df4b5d7ca9afe51963176df068d (diff)
downloadlz4-221211d7d04478d74eec9fd76ccd98a73bd394ee.zip
lz4-221211d7d04478d74eec9fd76ccd98a73bd394ee.tar.gz
lz4-221211d7d04478d74eec9fd76ccd98a73bd394ee.tar.bz2
Fix Offset Math
Diffstat (limited to 'lib/lz4hc.c')
-rw-r--r--lib/lz4hc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c
index 4a52f0c..5479159 100644
--- a/lib/lz4hc.c
+++ b/lib/lz4hc.c
@@ -93,12 +93,13 @@ static void LZ4HC_clearTables (LZ4HC_CCtx_internal* hc4)
static void LZ4HC_init (LZ4HC_CCtx_internal* hc4, const BYTE* start)
{
- U32 startingOffset = hc4->end - hc4->base + 64 KB;
+ uptrval startingOffset = hc4->end - hc4->base;
DEBUGLOG(4, "LZ4HC_init(%p, %p)", hc4, start);
if (startingOffset > 1 GB || startingOffset > (uptrval)start) {
MEM_INIT((void*)hc4->hashTable, 0, sizeof(hc4->hashTable));
- startingOffset = 64 KB;
+ startingOffset = 0;
}
+ startingOffset += MAX_DISTANCE;
hc4->nextToUpdate = startingOffset;
hc4->base = start - startingOffset;
hc4->end = start;