diff options
author | Yann Collet <cyan@fb.com> | 2016-11-04 14:13:49 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2016-11-04 14:18:03 (GMT) |
commit | 26dec498cf1bae39f4842e93b8bfe4d10b0395e9 (patch) | |
tree | 75d8895ec4bc49040ad10bb1e3f25f547395d956 | |
parent | 6d6a3e0fb582be4979404a5e8e368df8b891d686 (diff) | |
download | lz4-26dec498cf1bae39f4842e93b8bfe4d10b0395e9.zip lz4-26dec498cf1bae39f4842e93b8bfe4d10b0395e9.tar.gz lz4-26dec498cf1bae39f4842e93b8bfe4d10b0395e9.tar.bz2 |
small compression speed improvement on 64-bits systems
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | lib/lz4.c | 17 |
2 files changed, 12 insertions, 9 deletions
@@ -1,10 +1,12 @@ 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 r131 New : Dos/DJGPP target, thanks to Louis Santillan (#114) @@ -415,27 +415,28 @@ 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) { const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG; - const U32 hashMask = (1<<hashLog) - 1; - return ((sequence * prime5bytes) >> (40 - hashLog)) & hashMask; + return ((sequence << 24) * prime5bytes) >> (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) { |