summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2020-09-28 11:39:00 -0700
committerYann Collet <cyan@fb.com>2020-09-28 11:39:00 -0700
commitab89dda91d2c878c1f0638dabacf97b5a68ec361 (patch)
treea5ab16c82b416faadadb3961ad4cfe51b86bd6a7 /lib
parent89736e4e27358ed463c2482553cfae1b1176c797 (diff)
downloadlz4-ab89dda91d2c878c1f0638dabacf97b5a68ec361.tar.gz
lz4-ab89dda91d2c878c1f0638dabacf97b5a68ec361.tar.bz2
lz4-ab89dda91d2c878c1f0638dabacf97b5a68ec361.zip
improved last literals run on LZ4_compress_destSize
applying new more accurate formula from LZ4_compress_HC_destSize() also : fix some minor display issue in tests/frametest
Diffstat (limited to 'lib')
-rw-r--r--lib/lz4.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index 21c8b4c..dd0ed4b 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -1185,8 +1185,8 @@ _last_literals:
if (outputDirective == fillOutput) {
/* adapt lastRun to fill 'dst' */
assert(olimit >= op);
- lastRun = (size_t)(olimit-op) - 1;
- lastRun -= (lastRun+240)/255;
+ lastRun = (size_t)(olimit-op) - 1/*token*/;
+ lastRun -= (lastRun + 256 - RUN_MASK) / 256; /*additional length tokens*/
} else {
assert(outputDirective == limitedOutput);
return 0; /* cannot compress within `dst` budget. Stored indexes in hash table are nonetheless fine */