]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fixed : high compression modes for Windows 32 bits
authorYann Collet <yann.collet.73@gmail.com>
Fri, 11 Dec 2015 09:44:07 +0000 (10:44 +0100)
committerYann Collet <yann.collet.73@gmail.com>
Fri, 11 Dec 2015 09:44:07 +0000 (10:44 +0100)
.travis.yml
Makefile
NEWS
lib/zstd_compress.c
programs/Makefile
programs/zstdcli.c

index 846f1217588ef3022596aba15845085fe56b0d23..2d5a73a6ef1bb16929b032bc3e59a354f84705a4 100644 (file)
@@ -19,6 +19,7 @@ env:
   - 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:
index 9e7b70ee094fd3fa5bc3607719828bd5d1dc8f57..abec33f8671d8ca6f3cc22e4a53f33056accacc3 100644 (file)
--- 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 @@ usan: clean
 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 e7785b51c0954c040a798ea73d0a95740e3a91c2..50b26fb95c95fa7cae22e60040d27f4303d4fc22 100644 (file)
--- 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 :
index 046c035410f15053f07c2fa476a5b7d8e740bb7b..11e613882a9dd0c70f11806b47c69113b7cdc3f6 100644 (file)
@@ -1026,7 +1026,7 @@ static U32 ZSTD_insertBt1(ZSTD_CCtx* zc, const BYTE* const ip, const U32 mls, co
     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 @@ static U32 ZSTD_insertBt1(ZSTD_CCtx* zc, const BYTE* const ip, const U32 mls, co
         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 ZSTD_insertBtAndFindBestMatch (
     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 @@ static U32 ZSTD_insertBt1_extDict(ZSTD_CCtx* zc, const BYTE* const ip, const U32
     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 @@ static U32 ZSTD_insertBt1_extDict(ZSTD_CCtx* zc, const BYTE* const ip, const U32
         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 ZSTD_insertBtAndFindBestMatch_extDict (
     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 @@ size_t ZSTD_compressBlock_lazy_extDict_generic(ZSTD_CCtx* ctx,
 
     /* 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 @@ size_t ZSTD_compressContinue (ZSTD_CCtx* zc,
     }
 
     /* 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;
index 49061f94537428a75ecda264ae656adf92e9fdd1..b116fc6b03aeabfc2bc9f5b196084f043ebbafdd 100644 (file)
@@ -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
index 6f23c09a86ebd20f75059c61d85d4d95ceec5bb0..ef30f81323b7a5bdbdc136517522783e1d0d5f8b 100644 (file)
@@ -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__