updated release number
authorYann Collet <yann.collet.73@gmail.com>
Wed, 13 Aug 2014 15:44:44 +0000 (16:44 +0100)
committerYann Collet <yann.collet.73@gmail.com>
Wed, 13 Aug 2014 15:44:44 +0000 (16:44 +0100)
Makefile
lz4.c
programs/Makefile
programs/lz4cli.c

index 36e75c5..a81f30b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -31,7 +31,7 @@
 # ################################################################
 
 # Version numbers
-VERSION=121
+VERSION=122
 export RELEASE=r$(VERSION)
 LIBVER_MAJOR=`sed -n '/define LZ4_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < lz4.h`
 LIBVER_MINOR=`sed -n '/define LZ4_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < lz4.h`
diff --git a/lz4.c b/lz4.c
index d58be27..518521b 100644 (file)
--- a/lz4.c
+++ b/lz4.c
@@ -899,8 +899,8 @@ FORCE_INLINE int LZ4_decompress_generic(
     const BYTE* const lowLimit = (const BYTE*)dest - dictSize;
 
     const BYTE* const dictEnd = (const BYTE*)dictStart + dictSize;
-    const size_t dec32table[] = {4-0, 4-3, 4-2, 4-3, 4-0, 4-0, 4-0, 4-0};   /* note : static reduces speed for LZ4_decompress_safe() on GCC64 */
-    static const size_t dec64table[] = {0, 0, 0, (size_t)-1, 0, 1, 2, 3};
+    const size_t dec32table[] = {4, 1, 2, 1, 4, 4, 4, 4};
+    const size_t dec64table[] = {0, 0, 0, (size_t)-1, 0, 1, 2, 3};
 
     const int safeDecode = (endOnInput==endOnInputSize);
     const int checkOffset = ((safeDecode) && (dictSize < (int)(64 KB)));
@@ -971,24 +971,25 @@ FORCE_INLINE int LZ4_decompress_generic(
             } while (s==255);
             if ((safeDecode) && LZ4_32BITS && unlikely((size_t)(op+length)<(size_t)op)) goto _output_error;   /* overflow detection */
         }
+        length += MINMATCH;
 
         /* check external dictionary */
         if ((dict==usingExtDict) && (ref < (BYTE* const)dest))
         {
-            if (unlikely(op+length+MINMATCH > oend-LASTLITERALS)) goto _output_error;
+            if (unlikely(op+length > oend-LASTLITERALS)) goto _output_error;
 
-            if (length+MINMATCH <= (size_t)(dest-(char*)ref))
+            if (length <= (size_t)(dest-(char*)ref))
             {
                 ref = dictEnd - (dest-(char*)ref);
-                memcpy(op, ref, length+MINMATCH);
-                op += length+MINMATCH;
+                memcpy(op, ref, length);
+                op += length;
             }
             else
             {
                 size_t copySize = (size_t)(dest-(char*)ref);
                 memcpy(op, dictEnd - copySize, copySize);
                 op += copySize;
-                copySize = length+MINMATCH - copySize;
+                copySize = length - copySize;
                 if (copySize > (size_t)((char*)op-dest))   /* overlap */
                 {
                     BYTE* const endOfMatch = op + copySize;
@@ -1005,28 +1006,26 @@ FORCE_INLINE int LZ4_decompress_generic(
         }
 
         /* copy repeated sequence */
+        cpy = op + length;
         if (unlikely((op-ref)<(int)STEPSIZE))
         {
-            const size_t dec64 = dec64table[LZ4_32BITS ? 0 : op-ref];
+            const size_t dec64 = dec64table[op-ref];
             op[0] = ref[0];
             op[1] = ref[1];
             op[2] = ref[2];
             op[3] = ref[3];
             ref += dec32table[op-ref];
             A32(op+4) = A32(ref);
-            op += STEPSIZE; ref -= dec64;
-        } else { LZ4_COPYSTEP(op,ref); }
-        cpy = op + length - (STEPSIZE-4);
+            op += 8; ref -= dec64;
+        } else { LZ4_COPY8(op,ref); }
 
-        if (unlikely(cpy>oend-COPYLENGTH-(STEPSIZE-4)))
+        if (unlikely(cpy>oend-12))
         {
             if (cpy > oend-LASTLITERALS) goto _output_error;    /* Error : last 5 bytes must be literals */
             if (op<oend-COPYLENGTH) LZ4_WILDCOPY(op, ref, (oend-COPYLENGTH));
             while(op<cpy) *op++=*ref++;
-            op=cpy;
-            continue;
         }
-        LZ4_WILDCOPY(op, ref, cpy);
+        else LZ4_WILDCOPY(op, ref, cpy);
         op=cpy;   /* correction */
     }
 
index 05e98d2..d8d38f7 100644 (file)
 # fullbench32: Same as fullbench, but forced to compile in 32-bits mode
 # ##########################################################################
 
-RELEASE=r121
-DESTDIR=
-PREFIX=/usr
-CC:=$(CC)
-CFLAGS?= -O3
-CFLAGS+= -std=c99 -Wall -Wextra -Wundef -Wshadow -Wstrict-prototypes -DLZ4_VERSION=\"$(RELEASE)\"
-FLAGS= -I.. $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
+RELEASE=r122
+
+DESTDIR?=
+PREFIX ?= /usr
+CC     := $(CC)
+CFLAGS ?= -O3
+CFLAGS += -std=c99 -Wall -Wextra -Wundef -Wshadow -Wstrict-prototypes -DLZ4_VERSION=\"$(RELEASE)\"
+FLAGS   = -I.. $(CPPFLAGS) $(CFLAGS) $(LDFLAGS)
 
 BINDIR=$(PREFIX)/bin
 MANDIR=$(PREFIX)/share/man/man1
index e9b7506..1bbeda0 100644 (file)
 //****************************
 #define COMPRESSOR_NAME "LZ4 Compression CLI"
 #ifndef LZ4_VERSION
-#  define LZ4_VERSION "v1.2.0"
+#  define LZ4_VERSION "r122"
 #endif
 #define AUTHOR "Yann Collet"
 #define WELCOME_MESSAGE "*** %s %i-bits %s, by %s (%s) ***\n", COMPRESSOR_NAME, (int)(sizeof(void*)*8), LZ4_VERSION, AUTHOR, __DATE__