summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2017-11-08 16:42:59 (GMT)
committerYann Collet <cyan@fb.com>2017-11-08 16:42:59 (GMT)
commitfa03a9d3d983c0bc4a6ea843493d85d434188090 (patch)
tree7363f83f14fdf812b8cf77cd13d7df795c41a56d /lib
parentb07d36245a52048df233a90c382e523d4560fc64 (diff)
downloadlz4-fa03a9d3d983c0bc4a6ea843493d85d434188090.zip
lz4-fa03a9d3d983c0bc4a6ea843493d85d434188090.tar.gz
lz4-fa03a9d3d983c0bc4a6ea843493d85d434188090.tar.bz2
added code comments
Diffstat (limited to 'lib')
-rw-r--r--lib/lz4hc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c
index 02eafaf..b8d8a78 100644
--- a/lib/lz4hc.c
+++ b/lib/lz4hc.c
@@ -223,7 +223,7 @@ LZ4_FORCE_INLINE int LZ4HC_InsertAndGetWiderMatch (
if (LZ4_read32(matchPtr) == pattern) {
int mlt = MINMATCH + LZ4_count(ip+MINMATCH, matchPtr+MINMATCH, iHighLimit);
#if 0
- /* more generic but unfortunately slower ... */
+ /* more generic but unfortunately slower on clang */
int const back = LZ4HC_countBack(ip, matchPtr, iLowLimit, lowPrefixPtr);
#else
int back = 0;
@@ -297,11 +297,14 @@ LZ4_FORCE_INLINE int LZ4HC_InsertAndGetWiderMatch (
LZ4_FORCE_INLINE
int LZ4HC_InsertAndFindBestMatch(LZ4HC_CCtx_internal* const hc4, /* Index table will be updated */
- const BYTE* const ip, const BYTE* const iLimit,
- const BYTE** matchpos,
- const int maxNbAttempts)
+ const BYTE* const ip, const BYTE* const iLimit,
+ const BYTE** matchpos,
+ const int maxNbAttempts)
{
const BYTE* uselessPtr = ip;
+ /* note : LZ4HC_InsertAndGetWiderMatch() is able to modify the starting position of a match (*startpos),
+ * but this won't be the case here, as we define iLowLimit==ip,
+ * so LZ4HC_InsertAndGetWiderMatch() will not be allowed to search past ip */
return LZ4HC_InsertAndGetWiderMatch(hc4, ip, ip, iLimit, MINMATCH-1, matchpos, &uselessPtr, maxNbAttempts);
}
@@ -430,7 +433,7 @@ static int LZ4HC_compress_hashChain (
/* Main Loop */
while (ip < mflimit) {
- ml = LZ4HC_InsertAndFindBestMatch (ctx, ip, matchlimit, (&ref), maxNbAttempts);
+ ml = LZ4HC_InsertAndFindBestMatch (ctx, ip, matchlimit, &ref, maxNbAttempts);
if (ml<MINMATCH) { ip++; continue; }
/* saved, in case we would skip too much */