summaryrefslogtreecommitdiffstats
path: root/lib/lz4hc.c
diff options
context:
space:
mode:
authorYann Collet <Cyan4973@users.noreply.github.com>2022-09-16 19:20:34 (GMT)
committerGitHub <noreply@github.com>2022-09-16 19:20:34 (GMT)
commit27c9530b757afe7915d0e0d1622f4d1089b66b3c (patch)
treeaa7116d4258c9643050bfc3294eaf4a1e8163841 /lib/lz4hc.c
parente84f375421c131a61d096cc5649b05119b87a7a1 (diff)
parent7f54a56413c3e09e19925c93cf248b5a9b4acf48 (diff)
downloadlz4-27c9530b757afe7915d0e0d1622f4d1089b66b3c.zip
lz4-27c9530b757afe7915d0e0d1622f4d1089b66b3c.tar.gz
lz4-27c9530b757afe7915d0e0d1622f4d1089b66b3c.tar.bz2
Merge pull request #1163 from lz4/dict_fillOnIndex
remove usages of `base` pointer
Diffstat (limited to 'lib/lz4hc.c')
-rw-r--r--lib/lz4hc.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c
index fa3e014..446f55d 100644
--- a/lib/lz4hc.c
+++ b/lib/lz4hc.c
@@ -312,7 +312,7 @@ LZ4HC_InsertAndGetWiderMatch (
matchLength -= back;
if (matchLength > longest) {
longest = matchLength;
- *matchpos = prefixPtr - prefixIdx + matchIndex + back; /* virtual pos, relative to ip, to retrieve offset */
+ *matchpos = prefixPtr + matchIndex - prefixIdx + back; /* virtual pos, relative to ip, to retrieve offset */
*startpos = ip + back;
} } }
@@ -437,7 +437,7 @@ LZ4HC_InsertAndGetWiderMatch (
mlt -= back;
if (mlt > longest) {
longest = mlt;
- *matchpos = prefixPtr - prefixIdx + matchIndex + back;
+ *matchpos = prefixPtr - (prefixIdx - matchIndex) + back;
*startpos = ip + back;
DEBUGLOG(8, "found match of length %i at vPos=%i", longest, (int)matchIndex - (int)prefixIdx + back);
} }
@@ -803,16 +803,17 @@ static int LZ4HC_compress_optimal( LZ4HC_CCtx_internal* ctx,
const HCfavor_e favorDecSpeed);
-LZ4_FORCE_INLINE int LZ4HC_compress_generic_internal (
- LZ4HC_CCtx_internal* const ctx,
- const char* const src,
- char* const dst,
- int* const srcSizePtr,
- int const dstCapacity,
- int cLevel,
- const limitedOutput_directive limit,
- const dictCtx_directive dict
- )
+LZ4_FORCE_INLINE int
+LZ4HC_compress_generic_internal (
+ LZ4HC_CCtx_internal* const ctx,
+ const char* const src,
+ char* const dst,
+ int* const srcSizePtr,
+ int const dstCapacity,
+ int cLevel,
+ const limitedOutput_directive limit,
+ const dictCtx_directive dict
+ )
{
typedef enum { lz4hc, lz4opt } lz4hc_strat_e;
typedef struct {