summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS5
-rw-r--r--lib/lz4.c23
-rw-r--r--programs/lz4.12
-rw-r--r--programs/lz4cli.c4
-rw-r--r--tests/Makefile5
5 files changed, 26 insertions, 13 deletions
diff --git a/NEWS b/NEWS
index b676d86..7bfa3c5 100644
--- a/NEWS
+++ b/NEWS
@@ -1,10 +1,13 @@
v1.7.2
Changed : moved to versioning; package, cli and library have same version number
-Improved: Small decompression speed boost (+4%)
+Improved: Small decompression speed boost
+Improved: Small compression speed improvement on 64-bits systems
Improved: Performance on ARMv6 and ARMv7
Added : Debianization, by Evgeniy Polyakov
Makefile: Generates object files (*.o) for faster (re)compilation on low power systems
Fix : cli : crash on some invalid inputs
+Fix : cli : -t correctly validates lz4-compressed files, by Nick Terrell
+Fix : better ratio on 64-bits big-endian targets
r131
New : Dos/DJGPP target, thanks to Louis Santillan (#114)
diff --git a/lib/lz4.c b/lib/lz4.c
index 6a6aaf2..6db4c0b 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -415,27 +415,32 @@ int LZ4_sizeofState() { return LZ4_STREAMSIZE; }
static U32 LZ4_hashSequence(U32 sequence, tableType_t const tableType)
{
if (tableType == byU16)
- return (((sequence) * 2654435761U) >> ((MINMATCH*8)-(LZ4_HASHLOG+1)));
+ return ((sequence * 2654435761U) >> ((MINMATCH*8)-(LZ4_HASHLOG+1)));
else
- return (((sequence) * 2654435761U) >> ((MINMATCH*8)-LZ4_HASHLOG));
+ return ((sequence * 2654435761U) >> ((MINMATCH*8)-LZ4_HASHLOG));
}
-static const U64 prime5bytes = 889523592379ULL;
-static U32 LZ4_hashSequence64(size_t sequence, tableType_t const tableType)
+static U32 LZ4_hashSequence64(U64 sequence, tableType_t const tableType)
{
+ static const U64 prime5bytes = 889523592379ULL;
+ static const U64 prime8bytes = 11400714785074694791ULL;
const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG;
- const U32 hashMask = (1<<hashLog) - 1;
- return ((sequence * prime5bytes) >> (40 - hashLog)) & hashMask;
+ if (LZ4_isLittleEndian())
+ return (U32)(((sequence << 24) * prime5bytes) >> (64 - hashLog));
+ else
+ return (U32)(((sequence >> 24) * prime8bytes) >> (64 - hashLog));
}
static U32 LZ4_hashSequenceT(size_t sequence, tableType_t const tableType)
{
- if (LZ4_64bits())
- return LZ4_hashSequence64(sequence, tableType);
+ if (LZ4_64bits()) return LZ4_hashSequence64(sequence, tableType);
return LZ4_hashSequence((U32)sequence, tableType);
}
-static U32 LZ4_hashPosition(const void* p, tableType_t tableType) { return LZ4_hashSequenceT(LZ4_read_ARCH(p), tableType); }
+static U32 LZ4_hashPosition(const void* p, tableType_t tableType)
+{
+ return LZ4_hashSequenceT(LZ4_read_ARCH(p), tableType);
+}
static void LZ4_putPositionOnHash(const BYTE* p, U32 h, void* tableBase, tableType_t const tableType, const BYTE* srcBase)
{
diff --git a/programs/lz4.1 b/programs/lz4.1
index 51a37f1..059b820 100644
--- a/programs/lz4.1
+++ b/programs/lz4.1
@@ -121,7 +121,7 @@ Decompress.
.B --decompress
is also the default operation when the input filename has an
.B .lz4
-extensionq
+extension.
.TP
.BR \-t ", " \-\-test
Test the integrity of compressed
diff --git a/programs/lz4cli.c b/programs/lz4cli.c
index b707795..e49bbcb 100644
--- a/programs/lz4cli.c
+++ b/programs/lz4cli.c
@@ -569,7 +569,7 @@ int main(int argc, const char** argv)
if (multiple_inputs)
operationResult = LZ4IO_decompressMultipleFilenames(inFileNames, ifnIdx, LZ4_EXTENSION);
else
- DEFAULT_DECOMPRESSOR(input_filename, output_filename);
+ operationResult = DEFAULT_DECOMPRESSOR(input_filename, output_filename);
} else {
/* compression is default action */
if (legacy_format) {
@@ -579,7 +579,7 @@ int main(int argc, const char** argv)
if (multiple_inputs)
operationResult = LZ4IO_compressMultipleFilenames(inFileNames, ifnIdx, LZ4_EXTENSION, cLevel);
else
- DEFAULT_COMPRESSOR(input_filename, output_filename, cLevel);
+ operationResult = DEFAULT_COMPRESSOR(input_filename, output_filename, cLevel);
}
}
diff --git a/tests/Makefile b/tests/Makefile
index f8d7015..0dd8a59 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -220,6 +220,11 @@ test-lz4: lz4 datagen test-lz4-basic test-lz4-multiple test-lz4-sparse test-lz4-
./datagen | $(PRGDIR)/lz4 -tf && false || true
./datagen | $(PRGDIR)/lz4 -d > $(VOID) && false || true
./datagen | $(PRGDIR)/lz4 -df > $(VOID)
+ @echo "\n ---- test cli ----"
+ $(PRGDIR)/lz4 file-does-not-exist && false || true
+ $(PRGDIR)/lz4 -f file-does-not-exist && false || true
+ $(PRGDIR)/lz4 -fm file1-dne file2-dne && false || true
+ $(PRGDIR)/lz4 -fm file1-dne file2-dne && false || true
test-lz4c: lz4c datagen
@echo "\n ---- test lz4c version ----"