diff options
author | Yann Collet <cyan@fb.com> | 2017-11-02 21:53:06 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2017-11-02 21:53:06 (GMT) |
commit | 8e16eb0cd164071d3fc4c18e0f10527487649e93 (patch) | |
tree | 1c0081b508c3683b7486f8e8c00a5b2439f9a5fd /lib/lz4hc.c | |
parent | 0ff4df1b941145d5b728b4b4a936391537b8ea11 (diff) | |
download | lz4-8e16eb0cd164071d3fc4c18e0f10527487649e93.zip lz4-8e16eb0cd164071d3fc4c18e0f10527487649e93.tar.gz lz4-8e16eb0cd164071d3fc4c18e0f10527487649e93.tar.bz2 |
fixed last lost bytes in maximal mode
even gained 2 bytes on calgary.tar...
added conditional traces `g_debuglog_enable`
Diffstat (limited to 'lib/lz4hc.c')
-rw-r--r-- | lib/lz4hc.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c index eb31a9c..884f5d7 100644 --- a/lib/lz4hc.c +++ b/lib/lz4hc.c @@ -188,12 +188,15 @@ LZ4_FORCE_INLINE int LZ4HC_InsertAndGetWiderMatch ( repeat_state_e repeat = rep_untested; size_t srcPatternLength = 0; - + DEBUGLOG(7, "LZ4HC_InsertAndGetWiderMatch"); /* First Match */ LZ4HC_Insert(hc4, ip); matchIndex = HashTable[LZ4HC_hashPtr(ip)]; + DEBUGLOG(7, "First match at index %u / %u (lowLimit)", + matchIndex, lowLimit); while ((matchIndex>=lowLimit) && (nbAttempts)) { + DEBUGLOG(7, "remaining attempts : %i", nbAttempts); nbAttempts--; if (matchIndex >= dictLimit) { const BYTE* const matchPtr = base + matchIndex; @@ -360,16 +363,18 @@ LZ4_FORCE_INLINE int LZ4HC_encodeSequence ( #if defined(LZ4_DEBUG) && (LZ4_DEBUG >= 2) static const BYTE* start = NULL; static U32 totalCost = 0; + U32 const pos = (U32)(*anchor - start); U32 const ll = (U32)(*ip - *anchor); U32 const llAdd = (ll>=15) ? ((ll-15) / 255) + 1 : 0; U32 const mlAdd = (matchLength>=19) ? ((matchLength-19) / 255) + 1 : 0; U32 const cost = 1 + llAdd + ll + 2 + mlAdd; if (start==NULL) start = *anchor; /* only works for single segment */ - totalCost += cost; - DEBUGLOG(2, "pos:%7u -- literals:%3u, match:%4i, offset:%5u, cost:%3u/%7u", - (U32)(*anchor - start), + //g_debuglog_enable = (pos >= 112705) & (pos <= 112760); + DEBUGLOG(2, "pos:%7u -- literals:%3u, match:%4i, offset:%5u, cost:%3u / %u", + pos, (U32)(*ip - *anchor), matchLength, (U32)(*ip-match), cost, totalCost); + totalCost += cost; #endif /* Encode Literal length */ |