summaryrefslogtreecommitdiffstats
path: root/lib/lz4hc.c
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2016-09-03 02:32:06 (GMT)
committerYann Collet <cyan@fb.com>2016-09-03 02:32:06 (GMT)
commit64f556e610b68e6781e05d2d6470ebf8b8dff45c (patch)
treef541f4fbc7c2d999b63527324613f77f3d3d42bb /lib/lz4hc.c
parent5871585b6a28c6582d1626b8d07bb1a53a4cbd9d (diff)
downloadlz4-64f556e610b68e6781e05d2d6470ebf8b8dff45c.zip
lz4-64f556e610b68e6781e05d2d6470ebf8b8dff45c.tar.gz
lz4-64f556e610b68e6781e05d2d6470ebf8b8dff45c.tar.bz2
lz4cli version number from lz4.h
Diffstat (limited to 'lib/lz4hc.c')
-rw-r--r--lib/lz4hc.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/lz4hc.c b/lib/lz4hc.c
index c6f67cb..68afa98 100644
--- a/lib/lz4hc.c
+++ b/lib/lz4hc.c
@@ -313,8 +313,15 @@ FORCE_INLINE int LZ4HC_encodeSequence (
/* Encode MatchLength */
length = (int)(matchLength-MINMATCH);
if ((limitedOutputBuffer) && (*op + (length>>8) + (1 + LASTLITERALS) > oend)) return 1; /* Check output limit */
- if (length>=(int)ML_MASK) { *token+=ML_MASK; length-=ML_MASK; for(; length > 509 ; length-=510) { *(*op)++ = 255; *(*op)++ = 255; } if (length > 254) { length-=255; *(*op)++ = 255; } *(*op)++ = (BYTE)length; }
- else *token += (BYTE)(length);
+ if (length>=(int)ML_MASK) {
+ *token += ML_MASK;
+ length -= ML_MASK;
+ for(; length > 509 ; length-=510) { *(*op)++ = 255; *(*op)++ = 255; }
+ if (length > 254) { length-=255; *(*op)++ = 255; }
+ *(*op)++ = (BYTE)length;
+ } else {
+ *token += (BYTE)(length);
+ }
/* Prepare next loop */
*ip += matchLength;