diff options
author | Ruslan Kovalev <ruslan.a.kovalev@gmail.com> | 2022-02-10 16:46:44 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:44 +0300 |
commit | 59e19371de37995fcb36beb16cd6ec030af960bc (patch) | |
tree | fa68e36093ebff8b805462e9e6d331fe9d348214 /contrib/libs/lz4 | |
parent | 89db6fe2fe2c32d2a832ddfeb04e8d078e301084 (diff) | |
download | ydb-59e19371de37995fcb36beb16cd6ec030af960bc.tar.gz |
Restoring authorship annotation for Ruslan Kovalev <ruslan.a.kovalev@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/lz4')
-rw-r--r-- | contrib/libs/lz4/lz4.c | 322 | ||||
-rw-r--r-- | contrib/libs/lz4/lz4.h | 100 | ||||
-rw-r--r-- | contrib/libs/lz4/lz4hc.c | 218 | ||||
-rw-r--r-- | contrib/libs/lz4/lz4hc.h | 94 | ||||
-rw-r--r-- | contrib/libs/lz4/ya.make | 14 |
5 files changed, 374 insertions, 374 deletions
diff --git a/contrib/libs/lz4/lz4.c b/contrib/libs/lz4/lz4.c index c864ba73ba..915e205ae2 100644 --- a/contrib/libs/lz4/lz4.c +++ b/contrib/libs/lz4/lz4.c @@ -1,37 +1,37 @@ -/* - LZ4 - Fast LZ compression algorithm +/* + LZ4 - Fast LZ compression algorithm Copyright (C) 2011-present, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : + BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + You can contact the author at : - LZ4 homepage : http://www.lz4.org - LZ4 source repository : https://github.com/lz4/lz4 -*/ - +*/ + /*-************************************ * Tuning parameters **************************************/ @@ -43,7 +43,7 @@ #ifndef LZ4_HEAPMODE # define LZ4_HEAPMODE 0 #endif - + /* * LZ4_ACCELERATION_DEFAULT : * Select "acceleration" for LZ4_compress_fast() when parameter value <= 0 @@ -55,8 +55,8 @@ * get treated as LZ4_ACCELERATION_MAX instead (fix #876) */ #define LZ4_ACCELERATION_MAX 65537 - - + + /*-************************************ * CPU Feature Detection **************************************/ @@ -81,8 +81,8 @@ # elif (defined(__INTEL_COMPILER) && !defined(_WIN32)) || defined(__GNUC__) # define LZ4_FORCE_MEMORY_ACCESS 1 # endif -#endif - +#endif + /* * LZ4_FORCE_SW_BITCOUNT * Define this parameter if your target system or compiler does not support hardware bit count @@ -90,9 +90,9 @@ #if defined(_MSC_VER) && defined(_WIN32_WCE) /* Visual Studio for WinCE doesn't support Hardware bit count */ # undef LZ4_FORCE_SW_BITCOUNT /* avoid double def */ # define LZ4_FORCE_SW_BITCOUNT -#endif - - +#endif + + /*-************************************ * Dependency @@ -116,8 +116,8 @@ #define LZ4_STATIC_LINKING_ONLY /* LZ4_DISTANCE_MAX */ #include "lz4.h" /* see also "memory routines" below */ - - + + /*-************************************ * Compiler Options **************************************/ @@ -125,7 +125,7 @@ # include <intrin.h> /* only present in VS2005+ */ # pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ #endif /* _MSC_VER */ - + #ifndef LZ4_FORCE_INLINE # ifdef _MSC_VER /* Visual Studio */ # define LZ4_FORCE_INLINE static __forceinline @@ -165,24 +165,24 @@ #endif #if (defined(__GNUC__) && (__GNUC__ >= 3)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800)) || defined(__clang__) -# define expect(expr,value) (__builtin_expect ((expr),(value)) ) -#else -# define expect(expr,value) (expr) -#endif - +# define expect(expr,value) (__builtin_expect ((expr),(value)) ) +#else +# define expect(expr,value) (expr) +#endif + #ifndef likely -#define likely(expr) expect((expr) != 0, 1) +#define likely(expr) expect((expr) != 0, 1) #endif #ifndef unlikely -#define unlikely(expr) expect((expr) != 0, 0) +#define unlikely(expr) expect((expr) != 0, 0) #endif - + /* Should the alignment test prove unreliable, for some reason, * it can be disabled by setting LZ4_ALIGN_TEST to 0 */ #ifndef LZ4_ALIGN_TEST /* can be externally provided */ # define LZ4_ALIGN_TEST 1 #endif - + /*-************************************ * Memory routines @@ -206,8 +206,8 @@ void LZ4_free(void* p); #include <string.h> /* memset, memcpy */ #define MEM_INIT(p,v,s) memset((p),(v),(s)) - - + + /*-************************************ * Common Constants **************************************/ @@ -279,7 +279,7 @@ static int LZ4_isAligned(const void* ptr, size_t alignment) typedef int32_t S32; typedef uint64_t U64; typedef uintptr_t uptrval; -#else +#else # if UINT_MAX != 4294967295UL # error "LZ4 code (when not C++ or C99) assumes that sizeof(int) == 4" # endif @@ -289,14 +289,14 @@ static int LZ4_isAligned(const void* ptr, size_t alignment) typedef signed int S32; typedef unsigned long long U64; typedef size_t uptrval; /* generally true, except OpenVMS-64 */ -#endif - +#endif + #if defined(__x86_64__) typedef U64 reg_t; /* 64-bits in x32 mode */ #else typedef size_t reg_t; /* 32-bits in x32 mode */ -#endif - +#endif + typedef enum { notLimited = 0, limitedOutput = 1, @@ -327,15 +327,15 @@ static unsigned LZ4_isLittleEndian(void) const union { U32 u; BYTE c[4]; } one = { 1 }; /* don't use static : performance detrimental */ return one.c[0]; } - - + + #if defined(LZ4_FORCE_MEMORY_ACCESS) && (LZ4_FORCE_MEMORY_ACCESS==2) /* lie to the compiler about data alignment; use with caution */ - + static U16 LZ4_read16(const void* memPtr) { return *(const U16*) memPtr; } static U32 LZ4_read32(const void* memPtr) { return *(const U32*) memPtr; } static reg_t LZ4_read_ARCH(const void* memPtr) { return *(const reg_t*) memPtr; } - + static void LZ4_write16(void* memPtr, U16 value) { *(U16*)memPtr = value; } static void LZ4_write32(void* memPtr, U32 value) { *(U32*)memPtr = value; } @@ -598,14 +598,14 @@ static unsigned LZ4_NbCommonBytes (reg_t val) } } } - + #define STEPSIZE sizeof(reg_t) LZ4_FORCE_INLINE unsigned LZ4_count(const BYTE* pIn, const BYTE* pMatch, const BYTE* pInLimit) -{ +{ const BYTE* const pStart = pIn; - + if (likely(pIn < pInLimit-(STEPSIZE-1))) { reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn); if (!diff) { @@ -620,21 +620,21 @@ unsigned LZ4_count(const BYTE* pIn, const BYTE* pMatch, const BYTE* pInLimit) pIn += LZ4_NbCommonBytes(diff); return (unsigned)(pIn - pStart); } - + if ((STEPSIZE==8) && (pIn<(pInLimit-3)) && (LZ4_read32(pMatch) == LZ4_read32(pIn))) { pIn+=4; pMatch+=4; } if ((pIn<(pInLimit-1)) && (LZ4_read16(pMatch) == LZ4_read16(pIn))) { pIn+=2; pMatch+=2; } if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++; return (unsigned)(pIn - pStart); } - - + + #ifndef LZ4_COMMONDEFS_ONLY /*-************************************ * Local Constants **************************************/ static const int LZ4_64Klimit = ((64 KB) + (MFLIMIT-1)); static const U32 LZ4_skipTrigger = 6; /* Increase this value ==> compression run slower on incompressible data */ - + /*-************************************ * Local Structures and types @@ -698,13 +698,13 @@ int LZ4_decompress_safe_forceExtDict(const char* source, char* dest, * Compression functions ********************************/ LZ4_FORCE_INLINE U32 LZ4_hash4(U32 sequence, tableType_t const tableType) -{ +{ if (tableType == byU16) return ((sequence * 2654435761U) >> ((MINMATCH*8)-(LZ4_HASHLOG+1))); else return ((sequence * 2654435761U) >> ((MINMATCH*8)-LZ4_HASHLOG)); -} - +} + LZ4_FORCE_INLINE U32 LZ4_hash5(U64 sequence, tableType_t const tableType) { const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG; @@ -716,13 +716,13 @@ LZ4_FORCE_INLINE U32 LZ4_hash5(U64 sequence, tableType_t const tableType) return (U32)(((sequence >> 24) * prime8bytes) >> (64 - hashLog)); } } - + LZ4_FORCE_INLINE U32 LZ4_hashPosition(const void* const p, tableType_t const tableType) -{ +{ if ((sizeof(reg_t)==8) && (tableType != byU16)) return LZ4_hash5(LZ4_read_ARCH(p), tableType); return LZ4_hash4(LZ4_read32(p), tableType); -} - +} + LZ4_FORCE_INLINE void LZ4_clearHash(U32 h, void* tableBase, tableType_t const tableType) { switch (tableType) @@ -759,13 +759,13 @@ LZ4_FORCE_INLINE void LZ4_putPositionOnHash(const BYTE* p, U32 h, case byU16: { U16* hashTable = (U16*) tableBase; hashTable[h] = (U16)(p-srcBase); return; } } } - + LZ4_FORCE_INLINE void LZ4_putPosition(const BYTE* p, void* tableBase, tableType_t tableType, const BYTE* srcBase) { U32 const h = LZ4_hashPosition(p, tableType); LZ4_putPositionOnHash(p, h, tableBase, tableType, srcBase); } - + /* LZ4_getIndexOnHash() : * Index of match position registered in hash table. * hash position must be calculated by using base+index, or dictBase+index. @@ -787,7 +787,7 @@ LZ4_FORCE_INLINE U32 LZ4_getIndexOnHash(U32 h, const void* tableBase, tableType_ } assert(0); return 0; /* forbidden case */ } - + static const BYTE* LZ4_getPositionOnHash(U32 h, const void* tableBase, tableType_t tableType, const BYTE* srcBase) { if (tableType == byPtr) { const BYTE* const* hashTable = (const BYTE* const*) tableBase; return hashTable[h]; } @@ -803,7 +803,7 @@ LZ4_getPosition(const BYTE* p, U32 const h = LZ4_hashPosition(p, tableType); return LZ4_getPositionOnHash(h, tableBase, tableType, srcBase); } - + LZ4_FORCE_INLINE void LZ4_prepareTable(LZ4_stream_t_internal* const cctx, const int inputSize, @@ -862,7 +862,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic_validated( const dict_directive dictDirective, const dictIssue_directive dictIssue, const int acceleration) -{ +{ int result; const BYTE* ip = (const BYTE*) source; @@ -884,19 +884,19 @@ LZ4_FORCE_INLINE int LZ4_compress_generic_validated( const BYTE* const iend = ip + inputSize; const BYTE* const mflimitPlusOne = iend - MFLIMIT + 1; const BYTE* const matchlimit = iend - LASTLITERALS; - + /* the dictCtx currentOffset is indexed on the start of the dictionary, * while a dictionary in the current context precedes the currentOffset */ const BYTE* dictBase = !dictionary ? NULL : (dictDirective == usingDictCtx) ? dictionary + dictSize - dictCtx->currentOffset : dictionary + dictSize - startIndex; - BYTE* op = (BYTE*) dest; + BYTE* op = (BYTE*) dest; BYTE* const olimit = op + maxOutputSize; - + U32 offset = 0; - U32 forwardH; - + U32 forwardH; + DEBUGLOG(5, "LZ4_compress_generic_validated: srcSize=%i, tableType=%u", inputSize, tableType); assert(ip != NULL); /* If init conditions are not met, we don't have to mark stream @@ -916,22 +916,22 @@ LZ4_FORCE_INLINE int LZ4_compress_generic_validated( cctx->dictSize = (U32)inputSize; } else { cctx->dictSize += (U32)inputSize; - } + } cctx->currentOffset += (U32)inputSize; cctx->tableType = (U32)tableType; - + if (inputSize<LZ4_minLength) goto _last_literals; /* Input too small, no compression (all literals) */ /* First Byte */ LZ4_putPosition(ip, cctx->hashTable, tableType, base); ip++; forwardH = LZ4_hashPosition(ip, tableType); - + /* Main Loop */ for ( ; ; ) { const BYTE* match; - BYTE* token; + BYTE* token; const BYTE* filledIp; - + /* Find a match */ if (tableType == byPtr) { const BYTE* forwardIp = ip; @@ -942,10 +942,10 @@ LZ4_FORCE_INLINE int LZ4_compress_generic_validated( ip = forwardIp; forwardIp += step; step = (searchMatchNb++ >> LZ4_skipTrigger); - + if (unlikely(forwardIp > mflimitPlusOne)) goto _last_literals; assert(ip < mflimitPlusOne); - + match = LZ4_getPositionOnHash(h, cctx->hashTable, tableType, base); forwardH = LZ4_hashPosition(forwardIp, tableType); LZ4_putPositionOnHash(ip, h, cctx->hashTable, tableType, base); @@ -998,7 +998,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic_validated( } forwardH = LZ4_hashPosition(forwardIp, tableType); LZ4_putIndexOnHash(current, h, cctx->hashTable, tableType); - + DEBUGLOG(7, "candidate at pos=%u (offset=%u \n", matchIndex, current - matchIndex); if ((dictIssue == dictSmall) && (matchIndex < prefixIdxLimit)) { continue; } /* match outside of valid area */ assert(matchIndex < current); @@ -1015,11 +1015,11 @@ LZ4_FORCE_INLINE int LZ4_compress_generic_validated( } while(1); } - + /* Catch up */ filledIp = ip; while (((ip>anchor) & (match > lowLimit)) && (unlikely(ip[-1]==match[-1]))) { ip--; match--; } - + /* Encode Literals */ { unsigned const litLength = (unsigned)(ip - anchor); token = op++; @@ -1037,7 +1037,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic_validated( *token = (RUN_MASK<<ML_BITS); for(; len >= 255 ; len-=255) *op++ = 255; *op++ = (BYTE)len; - } + } else *token = (BYTE)(litLength<<ML_BITS); /* Copy Literals */ @@ -1045,9 +1045,9 @@ LZ4_FORCE_INLINE int LZ4_compress_generic_validated( op+=litLength; DEBUGLOG(6, "seq.start:%i, literals=%u, match.start:%i", (int)(anchor-(const BYTE*)source), litLength, (int)(ip-(const BYTE*)source)); - } - -_next_match: + } + +_next_match: /* at this stage, the following variables must be correctly set : * - ip : at start of LZ operation * - match : at start of previous pattern occurence; can be within current prefix, or within extDict @@ -1073,7 +1073,7 @@ _next_match: assert(ip-match <= LZ4_DISTANCE_MAX); LZ4_writeLE16(op, (U16)(ip - match)); op+=2; } - + /* Encode MatchLength */ { unsigned matchCode; @@ -1135,21 +1135,21 @@ _next_match: *op++ = (BYTE)(matchCode % 255); } else *token += (BYTE)(matchCode); - } + } /* Ensure we have enough space for the last literals. */ assert(!(outputDirective == fillOutput && op + 1 + LASTLITERALS > olimit)); - + anchor = ip; - + /* Test end of chunk */ if (ip >= mflimitPlusOne) break; - + /* Fill table */ LZ4_putPosition(ip-2, cctx->hashTable, tableType, base); - + /* Test next position */ if (tableType == byPtr) { - + match = LZ4_getPosition(ip, cctx->hashTable, tableType, base); LZ4_putPosition(ip, cctx->hashTable, tableType, base); if ( (match+LZ4_DISTANCE_MAX >= ip) @@ -1201,9 +1201,9 @@ _next_match: /* Prepare next loop */ forwardH = LZ4_hashPosition(++ip, tableType); - } - -_last_literals: + } + +_last_literals: /* Encode Last Literals */ { size_t lastRun = (size_t)(iend - anchor); if ( (outputDirective) && /* Check output buffer overflow */ @@ -1230,8 +1230,8 @@ _last_literals: LZ4_memcpy(op, anchor, lastRun); ip = anchor + lastRun; op += lastRun; - } - + } + if (outputDirective == fillOutput) { *inputConsumed = (int) (((const char*)ip)-source); } @@ -1239,8 +1239,8 @@ _last_literals: assert(result > 0); DEBUGLOG(5, "LZ4_compress_generic: compressed %i bytes into %i bytes", inputSize, result); return result; -} - +} + /** LZ4_compress_generic() : * inlined, to ensure branches are decided at compilation time; * takes care of src == (NULL, 0) @@ -1260,7 +1260,7 @@ LZ4_FORCE_INLINE int LZ4_compress_generic( { DEBUGLOG(5, "LZ4_compress_generic: srcSize=%i, dstCapacity=%i", srcSize, dstCapacity); - + if ((U32)srcSize > (U32)LZ4_MAX_INPUT_SIZE) { return 0; } /* Unsupported srcSize, too large (or negative) */ if (srcSize == 0) { /* src == NULL supported if srcSize == 0 */ if (outputDirective != notLimited && dstCapacity <= 0) return 0; /* no output, can't write anything */ @@ -1320,7 +1320,7 @@ int LZ4_compress_fast_extState_fastReset(void* state, const char* src, char* dst LZ4_stream_t_internal* ctx = &((LZ4_stream_t*)state)->internal_donotuse; if (acceleration < 1) acceleration = LZ4_ACCELERATION_DEFAULT; if (acceleration > LZ4_ACCELERATION_MAX) acceleration = LZ4_ACCELERATION_MAX; - + if (dstCapacity >= LZ4_compressBound(srcSize)) { if (srcSize < LZ4_64Klimit) { const tableType_t tableType = byU16; @@ -1354,17 +1354,17 @@ int LZ4_compress_fast_extState_fastReset(void* state, const char* src, char* dst int LZ4_compress_fast(const char* source, char* dest, int inputSize, int maxOutputSize, int acceleration) -{ +{ int result; #if (LZ4_HEAPMODE) LZ4_stream_t* ctxPtr = ALLOC(sizeof(LZ4_stream_t)); /* malloc-calloc always properly aligned */ if (ctxPtr == NULL) return 0; -#else +#else LZ4_stream_t ctx; LZ4_stream_t* const ctxPtr = &ctx; -#endif +#endif result = LZ4_compress_fast_extState(ctxPtr, source, dest, inputSize, maxOutputSize, acceleration); - + #if (LZ4_HEAPMODE) FREEMEM(ctxPtr); #endif @@ -1382,7 +1382,7 @@ int LZ4_compress_default(const char* src, char* dst, int srcSize, int maxOutputS * It is not safe to subsequently use the same state with a _fastReset() or * _continue() call without resetting it. */ static int LZ4_compress_destSize_extState (LZ4_stream_t* state, const char* src, char* dst, int* srcSizePtr, int targetDstSize) -{ +{ void* const s = LZ4_initStream(state, sizeof (*state)); assert(s != NULL); (void)s; @@ -1403,10 +1403,10 @@ int LZ4_compress_destSize(const char* src, char* dst, int* srcSizePtr, int targe #if (LZ4_HEAPMODE) LZ4_stream_t* ctx = (LZ4_stream_t*)ALLOC(sizeof(LZ4_stream_t)); /* malloc-calloc always properly aligned */ if (ctx == NULL) return 0; -#else +#else LZ4_stream_t ctxBody; LZ4_stream_t* ctx = &ctxBody; -#endif +#endif int result = LZ4_compress_destSize_extState(ctx, src, dst, srcSizePtr, targetDstSize); @@ -1414,9 +1414,9 @@ int LZ4_compress_destSize(const char* src, char* dst, int* srcSizePtr, int targe FREEMEM(ctx); #endif return result; -} - - +} + + /*-****************************** * Streaming functions @@ -1424,16 +1424,16 @@ int LZ4_compress_destSize(const char* src, char* dst, int* srcSizePtr, int targe #if !defined(ONLY_COMPRESS) LZ4_stream_t* LZ4_createStream(void) -{ +{ LZ4_stream_t* const lz4s = (LZ4_stream_t*)ALLOC(sizeof(LZ4_stream_t)); LZ4_STATIC_ASSERT(LZ4_STREAMSIZE >= sizeof(LZ4_stream_t_internal)); /* A compilation error here means LZ4_STREAMSIZE is not large enough */ DEBUGLOG(4, "LZ4_createStream %p", lz4s); if (lz4s == NULL) return NULL; LZ4_initStream(lz4s, sizeof(*lz4s)); return lz4s; -} +} #endif /* ONLY_COMPRESS */ - + static size_t LZ4_stream_t_alignment(void) { #if LZ4_ALIGN_TEST @@ -1462,7 +1462,7 @@ void LZ4_resetStream (LZ4_stream_t* LZ4_stream) DEBUGLOG(5, "LZ4_resetStream (ctx:%p)", LZ4_stream); MEM_INIT(LZ4_stream, 0, sizeof(LZ4_stream_t_internal)); } - + void LZ4_resetStream_fast(LZ4_stream_t* ctx) { LZ4_prepareTable(&(ctx->internal_donotuse), 0, byU32); } @@ -1474,8 +1474,8 @@ int LZ4_freeStream (LZ4_stream_t* LZ4_stream) FREEMEM(LZ4_stream); return (0); } - - + + #define HASH_UNIT sizeof(reg_t) int LZ4_loadDict (LZ4_stream_t* LZ4_dict, const char* dictionary, int dictSize) { @@ -1484,15 +1484,15 @@ int LZ4_loadDict (LZ4_stream_t* LZ4_dict, const char* dictionary, int dictSize) const BYTE* p = (const BYTE*)dictionary; const BYTE* const dictEnd = p + dictSize; const BYTE* base; - + DEBUGLOG(4, "LZ4_loadDict (%i bytes from %p into %p)", dictSize, dictionary, LZ4_dict); - + /* It's necessary to reset the context, * and not just continue it with prepareTable() * to avoid any risk of generating overflowing matchIndex * when compressing using this dictionary */ LZ4_resetStream(LZ4_dict); - + /* We always increment the offset by 64 KB, since, if the dict is longer, * we truncate it to the last 64k, and if it's shorter, we still want to * advance by a whole window length so we can provide the guarantee that @@ -1510,15 +1510,15 @@ int LZ4_loadDict (LZ4_stream_t* LZ4_dict, const char* dictionary, int dictSize) dict->dictionary = p; dict->dictSize = (U32)(dictEnd - p); dict->tableType = (U32)tableType; - + while (p <= dictEnd-HASH_UNIT) { LZ4_putPosition(p, dict->hashTable, tableType, base); p+=3; } - + return (int)dict->dictSize; } - + void LZ4_attach_dictionary(LZ4_stream_t* workingStream, const LZ4_stream_t* dictionaryStream) { const LZ4_stream_t_internal* dictCtx = dictionaryStream == NULL ? NULL : &(dictionaryStream->internal_donotuse); @@ -1559,14 +1559,14 @@ static void LZ4_renormDictT(LZ4_stream_t_internal* LZ4_dict, int nextSize) for (i=0; i<LZ4_HASH_SIZE_U32; i++) { if (LZ4_dict->hashTable[i] < delta) LZ4_dict->hashTable[i]=0; else LZ4_dict->hashTable[i] -= delta; - } + } LZ4_dict->currentOffset = 64 KB; if (LZ4_dict->dictSize > 64 KB) LZ4_dict->dictSize = 64 KB; LZ4_dict->dictionary = dictEnd - LZ4_dict->dictSize; } } - - + + int LZ4_compress_fast_continue (LZ4_stream_t* LZ4_stream, const char* source, char* dest, int inputSize, int maxOutputSize, @@ -1575,7 +1575,7 @@ int LZ4_compress_fast_continue (LZ4_stream_t* LZ4_stream, const tableType_t tableType = byU32; LZ4_stream_t_internal* streamPtr = &LZ4_stream->internal_donotuse; const BYTE* dictEnd = streamPtr->dictionary + streamPtr->dictSize; - + DEBUGLOG(5, "LZ4_compress_fast_continue (inputSize=%i)", inputSize); LZ4_renormDictT(streamPtr, inputSize); /* avoid index overflow */ @@ -1598,9 +1598,9 @@ int LZ4_compress_fast_continue (LZ4_stream_t* LZ4_stream, if (streamPtr->dictSize > 64 KB) streamPtr->dictSize = 64 KB; if (streamPtr->dictSize < 4) streamPtr->dictSize = 0; streamPtr->dictionary = dictEnd - streamPtr->dictSize; - } - } - + } + } + /* prefix mode : source data follows dictionary */ if (dictEnd == (const BYTE*)source) { if ((streamPtr->dictSize < 64 KB) && (streamPtr->dictSize < streamPtr->currentOffset)) @@ -1608,7 +1608,7 @@ int LZ4_compress_fast_continue (LZ4_stream_t* LZ4_stream, else return LZ4_compress_generic(streamPtr, source, dest, inputSize, NULL, maxOutputSize, limitedOutput, tableType, withPrefix64k, noDictIssue, acceleration); } - + /* external dictionary mode */ { int result; if (streamPtr->dictCtx) { @@ -1639,15 +1639,15 @@ int LZ4_compress_fast_continue (LZ4_stream_t* LZ4_stream, streamPtr->dictSize = (U32)inputSize; return result; } -} - - +} + + /* Hidden debug function, to force-test external dictionary mode */ int LZ4_compress_forceExtDict (LZ4_stream_t* LZ4_dict, const char* source, char* dest, int srcSize) -{ +{ LZ4_stream_t_internal* streamPtr = &LZ4_dict->internal_donotuse; int result; - + LZ4_renormDictT(streamPtr, srcSize); if ((streamPtr->dictSize < 64 KB) && (streamPtr->dictSize < streamPtr->currentOffset)) { @@ -1758,17 +1758,17 @@ LZ4_decompress_generic( { const BYTE* ip = (const BYTE*) src; const BYTE* const iend = ip + srcSize; - + BYTE* op = (BYTE*) dst; BYTE* const oend = op + outputSize; BYTE* cpy; - + const BYTE* const dictEnd = (dictStart == NULL) ? NULL : dictStart + dictSize; - + const int safeDecode = (endOnInput==endOnInputSize); const int checkOffset = ((safeDecode) && (dictSize < (int)(64 KB))); - - + + /* Set up the "end" pointers for the shortcut. */ const BYTE* const shortiend = iend - (endOnInput ? 14 : 8) /*maxLL*/ - 2 /*offset*/; const BYTE* const shortoend = oend - (endOnInput ? 14 : 8) /*maxLL*/ - 18 /*maxML*/; @@ -1844,12 +1844,12 @@ LZ4_decompress_generic( } ip += length; op = cpy; } - + /* get offset */ offset = LZ4_readLE16(ip); ip+=2; match = op - offset; assert(match <= op); - + /* get matchlength */ length = token & ML_MASK; @@ -1929,7 +1929,7 @@ LZ4_decompress_generic( } safe_decode: #endif - + /* Main Loop : decode remaining sequences where output < FASTLOOP_SAFE_DISTANCE */ while (1) { token = *ip++; @@ -2154,7 +2154,7 @@ LZ4_decompress_generic( } op = cpy; /* wildcopy correction */ } - + /* end of decoding */ if (endOnInput) { DEBUGLOG(5, "decoded %i bytes", (int) (((char*)op)-dst)); @@ -2162,12 +2162,12 @@ LZ4_decompress_generic( } else { return (int) (((const char*)ip)-src); /* Nb of input bytes read */ } - + /* Overflow error detected */ _output_error: return (int) (-(((const char*)ip)-src))-1; } -} +} /*===== Instantiate the API decoding functions. =====*/ diff --git a/contrib/libs/lz4/lz4.h b/contrib/libs/lz4/lz4.h index 66b8547bbc..fccf6168ed 100644 --- a/contrib/libs/lz4/lz4.h +++ b/contrib/libs/lz4/lz4.h @@ -1,51 +1,51 @@ -/* +/* * LZ4 - Fast LZ compression algorithm * Header File * Copyright (C) 2011-present, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : + BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + You can contact the author at : - LZ4 homepage : http://www.lz4.org - LZ4 source repository : https://github.com/lz4/lz4 -*/ +*/ #if defined (__cplusplus) && !defined(LZ4_NAMESPACE) extern "C" { #endif #ifndef LZ4_H_2983827168210 #define LZ4_H_2983827168210 - + /* --- Dependency --- */ #include <stddef.h> /* size_t */ - - + + /** Introduction - + LZ4 is lossless compression algorithm, providing compression speed >500 MB/s per core, scalable with multi-cores CPU. It features an extremely fast decoder, with speed in multiple GB/s per core, typically reaching RAM speed limits on multi-core systems. @@ -76,7 +76,7 @@ extern "C" { /*^*************************************************************** * Export parameters *****************************************************************/ -/* +/* * LZ4_DLL_EXPORT : * Enable exporting of functions when building a Windows DLL * LZ4LIB_VISIBILITY : @@ -96,12 +96,12 @@ extern "C" { #else # define LZ4LIB_API LZ4LIB_VISIBILITY #endif - + /*------ Version ------*/ #define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */ #define LZ4_VERSION_MINOR 9 /* for new (non-breaking) interface capabilities */ #define LZ4_VERSION_RELEASE 3 /* for tweaks, bug-fixes, or development */ - + #define LZ4_VERSION_NUMBER (LZ4_VERSION_MAJOR *100*100 + LZ4_VERSION_MINOR *100 + LZ4_VERSION_RELEASE) #define LZ4_LIB_VERSION LZ4_VERSION_MAJOR.LZ4_VERSION_MINOR.LZ4_VERSION_RELEASE @@ -162,14 +162,14 @@ LZ4LIB_API int LZ4_compress_default(const char* src, char* dst, int srcSize, int * If there is a need for a different format which bundles together both compressed data and its metadata, consider looking at lz4frame.h instead. */ LZ4LIB_API int LZ4_decompress_safe (const char* src, char* dst, int compressedSize, int dstCapacity); - - + + /*-************************************ * Advanced Functions **************************************/ #define LZ4_MAX_INPUT_SIZE 0x7E000000 /* 2 113 929 216 bytes */ #define LZ4_COMPRESSBOUND(isize) ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16) - + /*! LZ4_compressBound() : Provides the maximum size that LZ4 compression may output in a "worst case" scenario (input data not compressible) This function is primarily useful for memory allocation purposes (destination buffer size). @@ -180,7 +180,7 @@ LZ4LIB_API int LZ4_decompress_safe (const char* src, char* dst, int compressedSi or 0, if input size is incorrect (too large or negative) */ LZ4LIB_API int LZ4_compressBound(int inputSize); - + /*! LZ4_compress_fast() : Same as LZ4_compress_default(), but allows selection of "acceleration" factor. The larger the acceleration value, the faster the algorithm, but also the lesser the compression. @@ -188,10 +188,10 @@ LZ4LIB_API int LZ4_compressBound(int inputSize); An acceleration value of "1" is the same as regular LZ4_compress_default() Values <= 0 will be replaced by LZ4_ACCELERATION_DEFAULT (currently == 1, see lz4.c). Values > LZ4_ACCELERATION_MAX will be replaced by LZ4_ACCELERATION_MAX (currently == 65537, see lz4.c). -*/ +*/ LZ4LIB_API int LZ4_compress_fast (const char* src, char* dst, int srcSize, int dstCapacity, int acceleration); - - + + /*! LZ4_compress_fast_extState() : * Same as LZ4_compress_fast(), using an externally allocated memory space for its state. * Use LZ4_sizeofState() to know how much memory must be allocated, @@ -200,8 +200,8 @@ LZ4LIB_API int LZ4_compress_fast (const char* src, char* dst, int srcSize, int d */ LZ4LIB_API int LZ4_sizeofState(void); LZ4LIB_API int LZ4_compress_fast_extState (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration); - - + + /*! LZ4_compress_destSize() : * Reverse the logic : compresses as much data as possible from 'src' buffer * into already allocated buffer 'dst', of size >= 'targetDestSize'. @@ -226,8 +226,8 @@ LZ4LIB_API int LZ4_compress_fast_extState (void* state, const char* src, char* d * See https://github.com/lz4/lz4/issues/859 for details */ LZ4LIB_API int LZ4_compress_destSize (const char* src, char* dst, int* srcSizePtr, int targetDstSize); - - + + /*! LZ4_decompress_safe_partial() : * Decompress an LZ4 compressed block, of size 'srcSize' at position 'src', * into destination buffer 'dst' of size 'dstCapacity'. @@ -263,8 +263,8 @@ LZ4LIB_API int LZ4_compress_destSize (const char* src, char* dst, int* srcSizePt * Otherwise, *silent corruption will occur*. */ LZ4LIB_API int LZ4_decompress_safe_partial (const char* src, char* dst, int srcSize, int targetOutputSize, int dstCapacity); - - + + /*-********************************************* * Streaming Compression Functions ***********************************************/ @@ -775,5 +775,5 @@ LZ4LIB_API void LZ4_resetStream (LZ4_stream_t* streamPtr); #if defined (__cplusplus) && !defined(LZ4_NAMESPACE) -} -#endif +} +#endif diff --git a/contrib/libs/lz4/lz4hc.c b/contrib/libs/lz4/lz4hc.c index a556d47920..067b4dfedd 100644 --- a/contrib/libs/lz4/lz4hc.c +++ b/contrib/libs/lz4/lz4hc.c @@ -1,20 +1,20 @@ -/* +/* LZ4 HC - High Compression Mode of LZ4 Copyright (C) 2011-2017, Yann Collet. - + BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -30,14 +30,14 @@ You can contact the author at : - LZ4 source repository : https://github.com/lz4/lz4 - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c -*/ +*/ /* note : lz4hc is not an independent module, it requires lz4.h/lz4.c for proper compilation */ - - + + /* ************************************* * Tuning Parameter ***************************************/ - + /*! HEAPMODE : * Select how default compression function will allocate workplace memory, * in stack (0:fastest), or in heap (1:requires malloc()). @@ -45,27 +45,27 @@ */ #ifndef LZ4HC_HEAPMODE # define LZ4HC_HEAPMODE 1 -#endif - - +#endif + + /*=== Dependency ===*/ #define LZ4_HC_STATIC_LINKING_ONLY #include "lz4hc.h" - - + + /*=== Common definitions ===*/ #if defined(__GNUC__) # pragma GCC diagnostic ignored "-Wunused-function" -#endif +#endif #if defined (__clang__) # pragma clang diagnostic ignored "-Wunused-function" -#endif - +#endif + #define LZ4_COMMONDEFS_ONLY #ifndef LZ4_SRC_INCLUDED #include "lz4.c" /* LZ4_count, constants, mem */ #endif - + /*=== Enums ===*/ typedef enum { noDictCtx, usingDictCtxHc } dictCtx_directive; @@ -74,8 +74,8 @@ typedef enum { noDictCtx, usingDictCtxHc } dictCtx_directive; /*=== Constants ===*/ #define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH) #define LZ4_OPT_NUM (1<<12) - - + + /*=== Macros ===*/ #define MIN(a,b) ( (a) < (b) ? (a) : (b) ) #define MAX(a,b) ( (a) > (b) ? (a) : (b) ) @@ -84,10 +84,10 @@ typedef enum { noDictCtx, usingDictCtxHc } dictCtx_directive; #define DELTANEXTU16(table, pos) table[(U16)(pos)] /* faster */ /* Make fields passed to, and updated by LZ4HC_encodeSequence explicit */ #define UPDATABLE(ip, op, anchor) &ip, &op, &anchor - + static U32 LZ4HC_hashPtr(const void* ptr) { return HASH_FUNCTION(LZ4_read32(ptr)); } - - + + /************************************** * HC Compression **************************************/ @@ -112,8 +112,8 @@ static void LZ4HC_init_internal (LZ4HC_CCtx_internal* hc4, const BYTE* start) hc4->dictLimit = (U32) startingOffset; hc4->lowLimit = (U32) startingOffset; } - - + + /* Update chains up to ip (excluded) */ LZ4_FORCE_INLINE void LZ4HC_Insert (LZ4HC_CCtx_internal* hc4, const BYTE* ip) { @@ -122,7 +122,7 @@ LZ4_FORCE_INLINE void LZ4HC_Insert (LZ4HC_CCtx_internal* hc4, const BYTE* ip) const BYTE* const base = hc4->base; U32 const target = (U32)(ip - base); U32 idx = hc4->nextToUpdate; - + while (idx < target) { U32 const h = LZ4HC_hashPtr(base+idx); size_t delta = idx - hashTable[h]; @@ -131,10 +131,10 @@ LZ4_FORCE_INLINE void LZ4HC_Insert (LZ4HC_CCtx_internal* hc4, const BYTE* ip) hashTable[h] = idx; idx++; } - + hc4->nextToUpdate = target; } - + /** LZ4HC_countBack() : * @return : negative value, nb of common bytes before ip/match */ LZ4_FORCE_INLINE @@ -151,7 +151,7 @@ int LZ4HC_countBack(const BYTE* const ip, const BYTE* const match, back--; return back; } - + #if defined(_MSC_VER) # define LZ4HC_rotl32(x,r) _rotl(x,r) #else @@ -174,14 +174,14 @@ LZ4HC_countPattern(const BYTE* ip, const BYTE* const iEnd, U32 const pattern32) const BYTE* const iStart = ip; reg_t const pattern = (sizeof(pattern)==8) ? (reg_t)pattern32 + (((reg_t)pattern32) << (sizeof(pattern)*4)) : pattern32; - + while (likely(ip < iEnd-(sizeof(pattern)-1))) { reg_t const diff = LZ4_read_ARCH(ip) ^ pattern; if (!diff) { ip+=sizeof(pattern); continue; } ip += LZ4_NbCommonBytes(diff); return (unsigned)(ip - iStart); } - + if (LZ4_isLittleEndian()) { reg_t patternByte = pattern; while ((ip<iEnd) && (*ip == (BYTE)patternByte)) { @@ -195,10 +195,10 @@ LZ4HC_countPattern(const BYTE* ip, const BYTE* const iEnd, U32 const pattern32) ip ++; bitOffset -= 8; } } - + return (unsigned)(ip - iStart); } - + /* LZ4HC_reverseCountPattern() : * pattern must be a sample of repetitive pattern of length 1, 2 or 4 (but not 3!) * read using natural platform endianess */ @@ -206,7 +206,7 @@ static unsigned LZ4HC_reverseCountPattern(const BYTE* ip, const BYTE* const iLow, U32 pattern) { const BYTE* const iStart = ip; - + while (likely(ip >= iLow+4)) { if (LZ4_read32(ip-4) != pattern) break; ip -= 4; @@ -246,7 +246,7 @@ LZ4HC_InsertAndGetWiderMatch ( const int chainSwap, const dictCtx_directive dict, const HCfavor_e favorDecSpeed) -{ +{ U16* const chainTable = hc4->chainTable; U32* const HashTable = hc4->hashTable; const LZ4HC_CCtx_internal * const dictCtx = hc4->dictCtx; @@ -263,14 +263,14 @@ LZ4HC_InsertAndGetWiderMatch ( U32 matchIndex; repeat_state_e repeat = rep_untested; size_t srcPatternLength = 0; - + DEBUGLOG(7, "LZ4HC_InsertAndGetWiderMatch"); /* First Match */ LZ4HC_Insert(hc4, ip); matchIndex = HashTable[LZ4HC_hashPtr(ip)]; DEBUGLOG(7, "First match at index %u / %u (lowestMatchIndex)", matchIndex, lowestMatchIndex); - + while ((matchIndex>=lowestMatchIndex) && (nbAttempts>0)) { int matchLength=0; nbAttempts--; @@ -309,7 +309,7 @@ LZ4HC_InsertAndGetWiderMatch ( *matchpos = base + matchIndex + back; /* virtual pos, relative to ip, to retrieve offset */ *startpos = ip + back; } } } - + if (chainSwap && matchLength==longest) { /* better match => select a better chain */ assert(lookBackLength==0); /* search forward only */ if (matchIndex + (U32)longest <= ipIndex) { @@ -333,7 +333,7 @@ LZ4HC_InsertAndGetWiderMatch ( matchIndex -= distanceToNextMatch; continue; } } } - + { U32 const distNextMatch = DELTANEXTU16(chainTable, matchIndex); if (patternAnalysis && distNextMatch==1 && matchChainPos==0) { U32 const matchCandidateIdx = matchIndex-1; @@ -440,8 +440,8 @@ LZ4HC_InsertAndGetWiderMatch ( } } } return longest; -} - +} + LZ4_FORCE_INLINE int LZ4HC_InsertAndFindBestMatch(LZ4HC_CCtx_internal* const hc4, /* Index table will be updated */ const BYTE* const ip, const BYTE* const iLimit, @@ -456,7 +456,7 @@ int LZ4HC_InsertAndFindBestMatch(LZ4HC_CCtx_internal* const hc4, /* Index tabl * so LZ4HC_InsertAndGetWiderMatch() won't be allowed to search past ip */ return LZ4HC_InsertAndGetWiderMatch(hc4, ip, ip, iLimit, MINMATCH-1, matchpos, &uselessPtr, maxNbAttempts, patternAnalysis, 0 /*chainSwap*/, dict, favorCompressionRatio); } - + /* LZ4HC_encodeSequence() : * @return : 0 if ok, * 1 if buffer issue detected */ @@ -491,8 +491,8 @@ LZ4_FORCE_INLINE int LZ4HC_encodeSequence ( (U32)(ip - anchor), matchLength, (U32)(ip-match), cost, totalCost); totalCost += cost; -#endif - +#endif + /* Encode Literal length */ length = (size_t)(ip - anchor); LZ4_STATIC_ASSERT(notLimited == 0); @@ -510,15 +510,15 @@ LZ4_FORCE_INLINE int LZ4HC_encodeSequence ( } else { *token = (BYTE)(length << ML_BITS); } - + /* Copy Literals */ LZ4_wildCopy8(op, anchor, op + length); op += length; - + /* Encode Offset */ assert( (ip - match) <= LZ4_DISTANCE_MAX ); /* note : consider providing offset as a value, rather than as a pointer difference */ LZ4_writeLE16(op, (U16)(ip - match)); op += 2; - + /* Encode MatchLength */ assert(matchLength >= MINMATCH); length = (size_t)matchLength - MINMATCH; @@ -535,17 +535,17 @@ LZ4_FORCE_INLINE int LZ4HC_encodeSequence ( } else { *token += (BYTE)(length); } - + /* Prepare next loop */ ip += matchLength; anchor = ip; return 0; -} +} #undef ip #undef op #undef anchor - + LZ4_FORCE_INLINE int LZ4HC_compress_hashChain ( LZ4HC_CCtx_internal* const ctx, const char* const source, @@ -556,7 +556,7 @@ LZ4_FORCE_INLINE int LZ4HC_compress_hashChain ( const limitedOutput_directive limit, const dictCtx_directive dict ) -{ +{ const int inputSize = *srcSizePtr; const int patternAnalysis = (maxNbAttempts > 128); /* levels 9+ */ @@ -565,11 +565,11 @@ LZ4_FORCE_INLINE int LZ4HC_compress_hashChain ( const BYTE* const iend = ip + inputSize; const BYTE* const mflimit = iend - MFLIMIT; const BYTE* const matchlimit = (iend - LASTLITERALS); - + BYTE* optr = (BYTE*) dest; BYTE* op = (BYTE*) dest; BYTE* oend = op + maxOutputSize; - + int ml0, ml, ml2, ml3; const BYTE* start0; const BYTE* ref0; @@ -578,20 +578,20 @@ LZ4_FORCE_INLINE int LZ4HC_compress_hashChain ( const BYTE* ref2 = NULL; const BYTE* start3 = NULL; const BYTE* ref3 = NULL; - + /* init */ *srcSizePtr = 0; if (limit == fillOutput) oend -= LASTLITERALS; /* Hack for support LZ4 format restriction */ if (inputSize < LZ4_minLength) goto _last_literals; /* Input too small, no compression (all literals) */ - + /* Main Loop */ while (ip <= mflimit) { ml = LZ4HC_InsertAndFindBestMatch(ctx, ip, matchlimit, &ref, maxNbAttempts, patternAnalysis, dict); if (ml<MINMATCH) { ip++; continue; } - + /* saved, in case we would skip too much */ start0 = ip; ref0 = ref; ml0 = ml; - + _Search2: if (ip+ml <= mflimit) { ml2 = LZ4HC_InsertAndGetWiderMatch(ctx, @@ -600,18 +600,18 @@ _Search2: } else { ml2 = ml; } - + if (ml2 == ml) { /* No better match => encode ML1 */ optr = op; if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), ml, ref, limit, oend)) goto _dest_overflow; continue; } - + if (start0 < ip) { /* first match was skipped at least once */ if (start2 < ip + ml0) { /* squeezing ML1 between ML0(original ML1) and ML2 */ ip = start0; ref = ref0; ml = ml0; /* restore initial ML1 */ } } - + /* Here, start0==ip */ if ((start2 - ip) < 3) { /* First Match too small : removed */ ml = ml2; @@ -619,7 +619,7 @@ _Search2: ref =ref2; goto _Search2; } - + _Search3: /* At this stage, we have : * ml2 > ml1, and @@ -637,7 +637,7 @@ _Search3: } } /* Now, we have start2 = ip+new_ml, with new_ml = min(ml, OPTIMAL_ML=18) */ - + if (start2 + ml2 <= mflimit) { ml3 = LZ4HC_InsertAndGetWiderMatch(ctx, start2 + ml2 - 3, start2, matchlimit, ml2, &ref3, &start3, @@ -645,7 +645,7 @@ _Search3: } else { ml3 = ml2; } - + if (ml3 == ml2) { /* No better match => encode ML1 and ML2 */ /* ip & ref are known; Now for ml */ if (start2 < ip+ml) ml = (int)(start2 - ip); @@ -661,7 +661,7 @@ _Search3: } continue; } - + if (start3 < ip+ml+3) { /* Not enough space for match 2 : remove it */ if (start3 >= (ip+ml)) { /* can write Seq1 immediately ==> Seq2 is removed, so Seq3 becomes Seq1 */ if (start2 < ip+ml) { @@ -675,25 +675,25 @@ _Search3: ml2 = ml3; } } - + optr = op; if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), ml, ref, limit, oend)) goto _dest_overflow; ip = start3; ref = ref3; ml = ml3; - + start0 = start2; ref0 = ref2; ml0 = ml2; goto _Search2; } - + start2 = start3; ref2 = ref3; ml2 = ml3; goto _Search3; } - + /* * OK, now we have 3 ascending matches; * let's write the first one ML1. @@ -716,17 +716,17 @@ _Search3: } optr = op; if (LZ4HC_encodeSequence(UPDATABLE(ip, op, anchor), ml, ref, limit, oend)) goto _dest_overflow; - + /* ML2 becomes ML1 */ ip = start2; ref = ref2; ml = ml2; - + /* ML3 becomes ML2 */ start2 = start3; ref2 = ref3; ml2 = ml3; - + /* let's find a new ML3 */ goto _Search3; } - + _last_literals: /* Encode Last Literals */ { size_t lastRunSize = (size_t)(iend - anchor); /* literals */ @@ -754,11 +754,11 @@ _last_literals: memcpy(op, anchor, lastRunSize); op += lastRunSize; } - + /* End */ *srcSizePtr = (int) (((const char*)ip) - source); return (int) (((char*)op)-dest); - + _dest_overflow: if (limit == fillOutput) { /* Assumption : ip, anchor, ml and ref must be set correctly */ @@ -782,7 +782,7 @@ _dest_overflow: /* compression failed */ return 0; } - + static int LZ4HC_compress_optimal( LZ4HC_CCtx_internal* ctx, const char* const source, char* dst, @@ -854,10 +854,10 @@ LZ4_FORCE_INLINE int LZ4HC_compress_generic_internal ( if (result <= 0) ctx->dirty = 1; return result; } -} - +} + static void LZ4HC_setExternalDict(LZ4HC_CCtx_internal* ctxPtr, const BYTE* newBlock); - + static int LZ4HC_compress_generic_noDictCtx ( LZ4HC_CCtx_internal* const ctx, @@ -872,7 +872,7 @@ LZ4HC_compress_generic_noDictCtx ( assert(ctx->dictCtx == NULL); return LZ4HC_compress_generic_internal(ctx, src, dst, srcSizePtr, dstCapacity, cLevel, limit, noDictCtx); } - + static int LZ4HC_compress_generic_dictCtx ( LZ4HC_CCtx_internal* const ctx, @@ -943,7 +943,7 @@ int LZ4_compress_HC_extStateHC_fastReset (void* state, const char* src, char* ds else return LZ4HC_compress_generic (ctx, src, dst, &srcSize, dstCapacity, compressionLevel, notLimited); } - + int LZ4_compress_HC_extStateHC (void* state, const char* src, char* dst, int srcSize, int dstCapacity, int compressionLevel) { LZ4_streamHC_t* const ctx = LZ4_initStreamHC(state, sizeof(*ctx)); @@ -965,7 +965,7 @@ int LZ4_compress_HC(const char* src, char* dst, int srcSize, int dstCapacity, in #endif return cSize; } - + /* state is presumed sized correctly (>= sizeof(LZ4_streamHC_t)) */ int LZ4_compress_HC_destSize(void* state, const char* source, char* dest, int* sourceSizePtr, int targetDestSize, int cLevel) { @@ -975,8 +975,8 @@ int LZ4_compress_HC_destSize(void* state, const char* source, char* dest, int* s LZ4_setCompressionLevel(ctx, cLevel); return LZ4HC_compress_generic(&ctx->internal_donotuse, source, dest, sourceSizePtr, targetDestSize, cLevel, fillOutput); } - - + + /************************************** * Streaming Functions @@ -990,7 +990,7 @@ LZ4_streamHC_t* LZ4_createStreamHC(void) LZ4_setCompressionLevel(state, LZ4HC_CLEVEL_DEFAULT); return state; } - + int LZ4_freeStreamHC (LZ4_streamHC_t* LZ4_streamHCPtr) { DEBUGLOG(4, "LZ4_freeStreamHC(%p)", LZ4_streamHCPtr); @@ -998,7 +998,7 @@ int LZ4_freeStreamHC (LZ4_streamHC_t* LZ4_streamHCPtr) FREEMEM(LZ4_streamHCPtr); return 0; } - + LZ4_streamHC_t* LZ4_initStreamHC (void* buffer, size_t size) { @@ -1016,7 +1016,7 @@ LZ4_streamHC_t* LZ4_initStreamHC (void* buffer, size_t size) LZ4_setCompressionLevel(LZ4_streamHCPtr, LZ4HC_CLEVEL_DEFAULT); return LZ4_streamHCPtr; } - + /* just a stub */ void LZ4_resetStreamHC (LZ4_streamHC_t* LZ4_streamHCPtr, int compressionLevel) { @@ -1077,19 +1077,19 @@ int LZ4_loadDictHC (LZ4_streamHC_t* LZ4_streamHCPtr, if (dictSize >= 4) LZ4HC_Insert (ctxPtr, ctxPtr->end-3); return dictSize; } - + void LZ4_attach_HC_dictionary(LZ4_streamHC_t *working_stream, const LZ4_streamHC_t *dictionary_stream) { working_stream->internal_donotuse.dictCtx = dictionary_stream != NULL ? &(dictionary_stream->internal_donotuse) : NULL; } - + /* compression */ - + static void LZ4HC_setExternalDict(LZ4HC_CCtx_internal* ctxPtr, const BYTE* newBlock) { DEBUGLOG(4, "LZ4HC_setExternalDict(%p, %p)", ctxPtr, newBlock); if (ctxPtr->end >= ctxPtr->base + ctxPtr->dictLimit + 4) LZ4HC_Insert (ctxPtr, ctxPtr->end-3); /* Referencing remaining dictionary content */ - + /* Only one memory segment for extDict, so any previous extDict is lost at this stage */ ctxPtr->lowLimit = ctxPtr->dictLimit; ctxPtr->dictLimit = (U32)(ctxPtr->end - ctxPtr->base); @@ -1101,7 +1101,7 @@ static void LZ4HC_setExternalDict(LZ4HC_CCtx_internal* ctxPtr, const BYTE* newBl /* cannot reference an extDict and a dictCtx at the same time */ ctxPtr->dictCtx = NULL; } - + static int LZ4_compressHC_continue_generic (LZ4_streamHC_t* LZ4_streamHCPtr, const char* src, char* dst, @@ -1114,18 +1114,18 @@ LZ4_compressHC_continue_generic (LZ4_streamHC_t* LZ4_streamHCPtr, assert(ctxPtr != NULL); /* auto-init if forgotten */ if (ctxPtr->base == NULL) LZ4HC_init_internal (ctxPtr, (const BYTE*) src); - + /* Check overflow */ if ((size_t)(ctxPtr->end - ctxPtr->base) > 2 GB) { size_t dictSize = (size_t)(ctxPtr->end - ctxPtr->base) - ctxPtr->dictLimit; if (dictSize > 64 KB) dictSize = 64 KB; LZ4_loadDictHC(LZ4_streamHCPtr, (const char*)(ctxPtr->end) - dictSize, (int)dictSize); } - + /* Check if blocks follow each other */ if ((const BYTE*)src != ctxPtr->end) LZ4HC_setExternalDict(ctxPtr, (const BYTE*)src); - + /* Check overlapping input/dictionary space */ { const BYTE* sourceEnd = (const BYTE*) src + *srcSizePtr; const BYTE* const dictBegin = ctxPtr->dictBase + ctxPtr->lowLimit; @@ -1135,10 +1135,10 @@ LZ4_compressHC_continue_generic (LZ4_streamHC_t* LZ4_streamHCPtr, ctxPtr->lowLimit = (U32)(sourceEnd - ctxPtr->dictBase); if (ctxPtr->dictLimit - ctxPtr->lowLimit < 4) ctxPtr->lowLimit = ctxPtr->dictLimit; } } - + return LZ4HC_compress_generic (ctxPtr, src, dst, srcSizePtr, dstCapacity, ctxPtr->compressionLevel, limit); } - + int LZ4_compress_HC_continue (LZ4_streamHC_t* LZ4_streamHCPtr, const char* src, char* dst, int srcSize, int dstCapacity) { if (dstCapacity < LZ4_compressBound(srcSize)) @@ -1146,12 +1146,12 @@ int LZ4_compress_HC_continue (LZ4_streamHC_t* LZ4_streamHCPtr, const char* src, else return LZ4_compressHC_continue_generic (LZ4_streamHCPtr, src, dst, &srcSize, dstCapacity, notLimited); } - + int LZ4_compress_HC_continue_destSize (LZ4_streamHC_t* LZ4_streamHCPtr, const char* src, char* dst, int* srcSizePtr, int targetDestSize) { return LZ4_compressHC_continue_generic(LZ4_streamHCPtr, src, dst, srcSizePtr, targetDestSize, fillOutput); } - + /* LZ4_saveDictHC : @@ -1181,8 +1181,8 @@ int LZ4_saveDictHC (LZ4_streamHC_t* LZ4_streamHCPtr, char* safeBuffer, int dictS } return dictSize; } - - + + /*************************************************** * Deprecated Functions ***************************************************/ @@ -1200,41 +1200,41 @@ int LZ4_compressHC2_withStateHC (void* state, const char* src, char* dst, int sr int LZ4_compressHC2_limitedOutput_withStateHC (void* state, const char* src, char* dst, int srcSize, int maxDstSize, int cLevel) { return LZ4_compress_HC_extStateHC(state, src, dst, srcSize, maxDstSize, cLevel); } int LZ4_compressHC_continue (LZ4_streamHC_t* ctx, const char* src, char* dst, int srcSize) { return LZ4_compress_HC_continue (ctx, src, dst, srcSize, LZ4_compressBound(srcSize)); } int LZ4_compressHC_limitedOutput_continue (LZ4_streamHC_t* ctx, const char* src, char* dst, int srcSize, int maxDstSize) { return LZ4_compress_HC_continue (ctx, src, dst, srcSize, maxDstSize); } - - + + /* Deprecated streaming functions */ int LZ4_sizeofStreamStateHC(void) { return LZ4_STREAMHCSIZE; } - + /* state is presumed correctly sized, aka >= sizeof(LZ4_streamHC_t) * @return : 0 on success, !=0 if error */ int LZ4_resetStreamStateHC(void* state, char* inputBuffer) -{ +{ LZ4_streamHC_t* const hc4 = LZ4_initStreamHC(state, sizeof(*hc4)); if (hc4 == NULL) return 1; /* init failed */ LZ4HC_init_internal (&hc4->internal_donotuse, (const BYTE*)inputBuffer); return 0; } - + void* LZ4_createHC (const char* inputBuffer) { LZ4_streamHC_t* const hc4 = LZ4_createStreamHC(); if (hc4 == NULL) return NULL; /* not enough memory */ LZ4HC_init_internal (&hc4->internal_donotuse, (const BYTE*)inputBuffer); return hc4; -} - +} + int LZ4_freeHC (void* LZ4HC_Data) { if (!LZ4HC_Data) return 0; /* support free on NULL */ FREEMEM(LZ4HC_Data); return 0; } - + int LZ4_compressHC2_continue (void* LZ4HC_Data, const char* src, char* dst, int srcSize, int cLevel) { return LZ4HC_compress_generic (&((LZ4_streamHC_t*)LZ4HC_Data)->internal_donotuse, src, dst, &srcSize, 0, cLevel, notLimited); } - + int LZ4_compressHC2_limitedOutput_continue (void* LZ4HC_Data, const char* src, char* dst, int srcSize, int dstCapacity, int cLevel) { return LZ4HC_compress_generic (&((LZ4_streamHC_t*)LZ4HC_Data)->internal_donotuse, src, dst, &srcSize, dstCapacity, cLevel, limitedOutput); diff --git a/contrib/libs/lz4/lz4hc.h b/contrib/libs/lz4/lz4hc.h index 3d441fb6fa..1f92d375eb 100644 --- a/contrib/libs/lz4/lz4hc.h +++ b/contrib/libs/lz4/lz4hc.h @@ -1,48 +1,48 @@ -/* - LZ4 HC - High Compression Mode of LZ4 - Header File +/* + LZ4 HC - High Compression Mode of LZ4 + Header File Copyright (C) 2011-2017, Yann Collet. - BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - You can contact the author at : + BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following disclaimer + in the documentation and/or other materials provided with the + distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + You can contact the author at : - LZ4 source repository : https://github.com/lz4/lz4 - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c -*/ +*/ #ifndef LZ4_HC_H_19834876238432 #define LZ4_HC_H_19834876238432 - -#if defined (__cplusplus) -extern "C" { -#endif - + +#if defined (__cplusplus) +extern "C" { +#endif + /* --- Dependency --- */ /* note : lz4hc requires lz4.h/lz4.c for compilation */ #include "lz4.h" /* stddef, LZ4LIB_API, LZ4_DEPRECATED */ - - + + /* --- Useful constants --- */ #define LZ4HC_CLEVEL_MIN 3 #define LZ4HC_CLEVEL_DEFAULT 9 @@ -109,7 +109,7 @@ LZ4LIB_API int LZ4_compress_HC_destSize(void* stateHC, LZ4LIB_API LZ4_streamHC_t* LZ4_createStreamHC(void); LZ4LIB_API int LZ4_freeStreamHC (LZ4_streamHC_t* streamHCPtr); -/* +/* These functions compress data in successive blocks of any size, using previous blocks as dictionary, to improve compression ratio. One key assumption is that previous blocks (up to 64 KB) remain read-accessible while compressing next blocks. @@ -150,11 +150,11 @@ LZ4LIB_API int LZ4_freeStreamHC (LZ4_streamHC_t* streamHCPtr); After completing a streaming compression, it's possible to start a new stream of blocks, using the same LZ4_streamHC_t state, just by resetting it, using LZ4_resetStreamHC_fast(). -*/ - +*/ + LZ4LIB_API void LZ4_resetStreamHC_fast(LZ4_streamHC_t* streamHCPtr, int compressionLevel); /* v1.9.0+ */ LZ4LIB_API int LZ4_loadDictHC (LZ4_streamHC_t* streamHCPtr, const char* dictionary, int dictSize); - + LZ4LIB_API int LZ4_compress_HC_continue (LZ4_streamHC_t* streamHCPtr, const char* src, char* dst, int srcSize, int maxDstSize); @@ -239,13 +239,13 @@ union LZ4_streamHC_u { * * Static allocation shall only be used in combination with static linking. */ - + /* LZ4_initStreamHC() : v1.9.0+ * Required before first use of a statically allocated LZ4_streamHC_t. * Before v1.9.0 : use LZ4_resetStreamHC() instead */ LZ4LIB_API LZ4_streamHC_t* LZ4_initStreamHC (void* buffer, size_t size); - + /*-************************************ * Deprecated Functions @@ -292,10 +292,10 @@ LZ4_DEPRECATED("use LZ4_initStreamHC() instead") LZ4LIB_API int LZ4_resetStre LZ4LIB_API void LZ4_resetStreamHC (LZ4_streamHC_t* streamHCPtr, int compressionLevel); -#if defined (__cplusplus) -} -#endif - +#if defined (__cplusplus) +} +#endif + #endif /* LZ4_HC_H_19834876238432 */ diff --git a/contrib/libs/lz4/ya.make b/contrib/libs/lz4/ya.make index 282dfe3920..7953916f33 100644 --- a/contrib/libs/lz4/ya.make +++ b/contrib/libs/lz4/ya.make @@ -1,5 +1,5 @@ # Generated by devtools/yamaker from nixpkgs 5852a21819542e6809f68ba5a798600e69874e76. - + LIBRARY() OWNER( @@ -21,17 +21,17 @@ LICENSE_TEXTS(.yandex_meta/licenses.list.txt) PEERDIR( contrib/libs/xxhash ) - + ADDINCL( contrib/libs/xxhash ) NO_RUNTIME() -SRCS( - lz4.c +SRCS( + lz4.c lz4frame.c - lz4hc.c -) - + lz4hc.c +) + END() |