fixed : high compression modes for Windows 32 bits
diff --git a/.travis.yml b/.travis.yml
index 846f121..2d5a73a 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,6 +19,7 @@
- ZSTD_TRAVIS_CI_ENV="-C programs test-zstd_nolegacy"
- ZSTD_TRAVIS_CI_ENV=usan
- ZSTD_TRAVIS_CI_ENV=asan
+ - ZSTD_TRAVIS_CI_ENV=asan32
- ZSTD_TRAVIS_CI_ENV="-C programs valgrindTest"
matrix:
diff --git a/Makefile b/Makefile
index 9e7b70e..abec33f 100644
--- a/Makefile
+++ b/Makefile
@@ -32,7 +32,7 @@
# ################################################################
# Version number
-export VERSION := 0.4.3
+export VERSION := 0.4.4
PRGDIR = programs
ZSTDDIR = lib
@@ -96,6 +96,9 @@
asan: clean
$(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=address"
+asan32: clean
+ $(MAKE) -C $(PRGDIR) test32 CC=clang MOREFLAGS="-g -fsanitize=address"
+
uasan: clean
$(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=address -fsanitize=undefined"
diff --git a/NEWS b/NEWS
index e7785b5..50b26fb 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,5 @@
v0.4.4
+Fixed : high compression modes for Windows 32 bits
new : windows DLL project, thanks to Christophe Chevalier
v0.4.3 :
diff --git a/lib/zstd_compress.c b/lib/zstd_compress.c
index 046c035..11e6138 100644
--- a/lib/zstd_compress.c
+++ b/lib/zstd_compress.c
@@ -1026,7 +1026,7 @@
size_t commonLengthSmaller=0, commonLengthLarger=0;
const BYTE* const base = zc->base;
const BYTE* match = base + matchIndex;
- U32 current = (U32)(ip-base);
+ const U32 current = (U32)(ip-base);
const U32 btLow = btMask >= current ? 0 : current - btMask;
U32* smallerPtr = bt + 2*(current&btMask);
U32* largerPtr = bt + 2*(current&btMask) + 1;
@@ -1040,7 +1040,7 @@
return (U32)(rleLength - mls);
}
- hashTable[h] = (U32)(ip - base); /* Update Hash Table */
+ hashTable[h] = current; /* Update Hash Table */
while (nbCompares-- && (matchIndex > windowLow))
{
@@ -1103,7 +1103,7 @@
size_t bestLength = 0;
U32 dummy32; /* to be nullified at the end */
- hashTable[h] = (U32)(ip-base); /* Update Hash Table */
+ hashTable[h] = current; /* Update Hash Table */
while (nbCompares-- && (matchIndex > windowLow))
{
@@ -1213,7 +1213,7 @@
const BYTE* const dictEnd = dictBase + dictLimit;
const BYTE* const prefixStart = base + dictLimit;
const BYTE* match = base + matchIndex;
- U32 current = (U32)(ip-base);
+ const U32 current = (U32)(ip-base);
const U32 btLow = btMask >= current ? 0 : current - btMask;
U32* smallerPtr = bt + 2*(current&btMask);
U32* largerPtr = bt + 2*(current&btMask) + 1;
@@ -1227,7 +1227,7 @@
return (U32)(rleLength - mls);
}
- hashTable[h] = (U32)(ip - base); /* Update Hash Table */
+ hashTable[h] = current; /* Update Hash Table */
while (nbCompares-- && (matchIndex > windowLow))
{
@@ -1318,7 +1318,7 @@
size_t bestLength = 0;
U32 dummy32; /* to be nullified at the end */
- hashTable[h] = (U32)(ip-base); /* Update Hash Table */
+ hashTable[h] = current; /* Update Hash Table */
while (nbCompares-- && (matchIndex > windowLow))
{
@@ -1726,7 +1726,7 @@
/* init */
ZSTD_resetSeqStore(seqStorePtr);
- if (((ip-base) - dictLimit) < REPCODE_STARTVALUE) ip += REPCODE_STARTVALUE;
+ if ((ip - prefixStart) < REPCODE_STARTVALUE) ip += REPCODE_STARTVALUE;
/* Match Loop */
while (ip < ilimit)
@@ -2008,13 +2008,16 @@
}
/* preemptive overflow correction */
- if ((zc->base > ip) || (zc->lowLimit > (1<<30) ))
+ if (zc->lowLimit > (1<<30))
{
- U32 correction = zc->lowLimit-1;
+ U32 btplus = (zc->params.strategy == ZSTD_btlazy2);
+ U32 contentMask = (1 << (zc->params.contentLog - btplus)) - 1;
+ U32 newLowLimit = zc->lowLimit & contentMask; /* preserve position % contentSize */
+ U32 correction = zc->lowLimit - newLowLimit;
ZSTD_reduceIndex(zc, correction);
zc->base += correction;
zc->dictBase += correction;
- zc->lowLimit -= correction;
+ zc->lowLimit = newLowLimit;
zc->dictLimit -= correction;
if (zc->nextToUpdate < correction) zc->nextToUpdate = 0;
else zc->nextToUpdate -= correction;
diff --git a/programs/Makefile b/programs/Makefile
index 49061f9..b116fc6 100644
--- a/programs/Makefile
+++ b/programs/Makefile
@@ -30,7 +30,7 @@
# fullbench32: Same as fullbench, but forced to compile in 32-bits mode
# ##########################################################################
-VERSION?= 0.4.3
+VERSION?= 0.4.4
DESTDIR?=
PREFIX ?= /usr/local
diff --git a/programs/zstdcli.c b/programs/zstdcli.c
index 6f23c09..ef30f81 100644
--- a/programs/zstdcli.c
+++ b/programs/zstdcli.c
@@ -70,7 +70,7 @@
**************************************/
#define COMPRESSOR_NAME "zstd command line interface"
#ifndef ZSTD_VERSION
-# define ZSTD_VERSION "v0.4.2"
+# define ZSTD_VERSION "v0.4.4"
#endif
#define AUTHOR "Yann Collet"
#define WELCOME_MESSAGE "*** %s %i-bits %s, by %s (%s) ***\n", COMPRESSOR_NAME, (int)(sizeof(void*)*8), ZSTD_VERSION, AUTHOR, __DATE__