summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2018-05-03 18:54:57 (GMT)
committerYann Collet <cyan@fb.com>2018-05-03 18:54:57 (GMT)
commitffbff1f3602d53a82f1b80b3669fe24219bde544 (patch)
tree69ae53c32b8decdc9e41d75922877fc30bc15664
parent1e130d23e3b5f86e30e5dd7d3c1fc6d93d63e53f (diff)
parent95607a749b8bbe6f9323408ddd740ef4ff248794 (diff)
downloadlz4-ffbff1f3602d53a82f1b80b3669fe24219bde544.zip
lz4-ffbff1f3602d53a82f1b80b3669fe24219bde544.tar.gz
lz4-ffbff1f3602d53a82f1b80b3669fe24219bde544.tar.bz2
Merge branch 'dev' into lz4fRingBuffer
-rw-r--r--lib/lz4.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index 71fe8f3..3860c51 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -1427,10 +1427,9 @@ LZ4_FORCE_INLINE int LZ4_decompress_generic(
* those 18 bytes earlier, upon entering the shortcut (in other words,
* there is a combined check for both stages).
*/
- if ((endOnInput ? length != RUN_MASK : length <= 8) &&
+ if ( (endOnInput ? length != RUN_MASK : length <= 8)
/* strictly "less than" on input, to re-enter the loop with at least one byte */
- likely((endOnInput ? ip < shortiend : 1) & (op <= shortoend)))
- {
+ && likely((endOnInput ? ip < shortiend : 1) & (op <= shortoend)) ) {
/* Copy the literals */
memcpy(op, ip, endOnInput ? 16 : 8);
op += length; ip += length;
@@ -1442,9 +1441,9 @@ LZ4_FORCE_INLINE int LZ4_decompress_generic(
match = op - offset;
/* Do not deal with overlapping matches. */
- if ((length != 15) && (offset >= 8) &&
- (dict==withPrefix64k || match >= lowPrefix))
- {
+ if ( (length != ML_MASK)
+ && (offset >= 8)
+ && (dict==withPrefix64k || match >= lowPrefix) ) {
/* Copy the match. */
memcpy(op + 0, match + 0, 8);
memcpy(op + 8, match + 8, 8);
@@ -1709,13 +1708,12 @@ int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dicti
* provides the minimum size of this ring buffer
* to be compatible with any source respecting maxBlockSize condition.
* Note : in a ring buffer scenario,
- * blocks are presumed decompressed next to each other
- * up to the moment there is not enough remaining space for next block (remainingSize < maxBlockSize),
- * at which stage it resumes from beginning of ring buffer.
+ * blocks are presumed decompressed next to each other.
+ * When not enough space remains for next block (remainingSize < maxBlockSize),
+ * decoding resumes from beginning of ring buffer.
* @return : minimum ring buffer size,
* or 0 if there is an error (invalid maxBlockSize).
*/
-
int LZ4_decoderRingBufferSize(int maxBlockSize)
{
if (maxBlockSize < 0) return 0;