diff options
author | qrort <qrort@yandex-team.com> | 2022-12-02 11:31:25 +0300 |
---|---|---|
committer | qrort <qrort@yandex-team.com> | 2022-12-02 11:31:25 +0300 |
commit | b1f4ffc9c8abff3ba58dc1ec9a9f92d2f0de6806 (patch) | |
tree | 2a23209faf0fea5586a6d4b9cee60d1b318d29fe /contrib/libs/quicklz | |
parent | 559174a9144de40d6bb3997ea4073c82289b4974 (diff) | |
download | ydb-b1f4ffc9c8abff3ba58dc1ec9a9f92d2f0de6806.tar.gz |
remove kikimr/driver DEPENDS
Diffstat (limited to 'contrib/libs/quicklz')
63 files changed, 0 insertions, 3502 deletions
diff --git a/contrib/libs/quicklz/1.31/quicklz.c b/contrib/libs/quicklz/1.31/quicklz.c deleted file mode 100644 index 1a43cd41179..00000000000 --- a/contrib/libs/quicklz/1.31/quicklz.c +++ /dev/null @@ -1,977 +0,0 @@ -// QuickLZ data compression library -// Copyright (C) 2006-2007 Lasse Mikkel Reinhold -// lar@quicklz.com -// -// QuickLZ can be used for free under the GPL-1 or GPL-2 license (where anything -// released into public must be open source) or under a commercial license if such -// has been acquired (see http://www.quicklz.com/order.html). The commercial license -// does not cover derived or ported versions created by third parties under GPL. -#include <string.h> - -#include "yquicklz.h" - -// Version 1.31 final -#define QLZ_VERSION_MAJOR 1 -#define QLZ_VERSION_MINOR 3 -#define QLZ_VERSION_REVISION 1 - -#define test_rle -#define speedup_incompressible -//#define memory_safe -#ifndef _WIN32 -# define __inline static inline -#endif - -#if (defined(__GNUC__) && (__GNUC__ > 2)) -# define EXPECT_FALSE(Cond) __builtin_expect(!!(Cond), 0) -#else -# define EXPECT_FALSE(Cond) (Cond) -#endif - - -// Public functions of QuickLZ -size_t qlz_decompress(const char *source, void *destination, char *scratch); -size_t qlz_compress(const void *source, char *destination, size_t size, char *scratch); -size_t qlz_size_decompressed(const char *source); -size_t qlz_size_compressed(const char *source); -int qlz_get_setting(int setting); - -#if (defined(__X86__) || defined(__i386__) || defined(i386) || defined(_M_IX86) || defined(__386__) || defined(__x86_64__) || defined(_M_X64)) - #define X86X64 -#endif - -// Compute SCRATCH_COMPRESS, SCRATCH_DECOMPRESS and constants used internally -#if COMPRESSION_LEVEL == 0 && defined(memory_safe) - #error memory_safe flag cannot be used with COMPRESSION_LEVEL 0 -#endif - -#define HASH_ENTRIES 4096 - -#if (COMPRESSION_LEVEL == 0 || COMPRESSION_LEVEL == 1 || COMPRESSION_LEVEL == 2) - #define AND 1 -#elif (COMPRESSION_LEVEL == 3) - #define AND 0x7 -#else - #error COMPRESSION_LEVEL must be 0, 1, 2 or 3 -#endif - -#define HASH_SIZE (AND + 1)*HASH_ENTRIES*sizeof(unsigned char *) - -#ifdef STREAMING_MODE - #define STREAMING_MODE_VALUE STREAMING_MODE -#else - #define STREAMING_MODE_VALUE 0 -#endif - -#define STREAMING_MODE_ROUNDED ((STREAMING_MODE_VALUE >> 3) << 3) - -#if (COMPRESSION_LEVEL > 1) - #define SCRATCH_COMPRESS HASH_SIZE + STREAMING_MODE_VALUE + 16 + HASH_ENTRIES -#else - #define SCRATCH_COMPRESS HASH_SIZE + STREAMING_MODE_VALUE + 16 -#endif - -#if (COMPRESSION_LEVEL == 0) - #define SCRATCH_DECOMPRESS HASH_ENTRIES*sizeof(unsigned char *) + 16 + STREAMING_MODE_VALUE -#else - #define SCRATCH_DECOMPRESS 16 + STREAMING_MODE_VALUE -#endif - -int qlz_get_setting(int setting) -{ - switch (setting) - { - case 0: return COMPRESSION_LEVEL; - case 1: return SCRATCH_COMPRESS; - case 2: return SCRATCH_DECOMPRESS; - case 3: return STREAMING_MODE_VALUE; -#ifdef test_rle - case 4: return 1; -#else - case 4: return 0; -#endif -#ifdef speedup_incompressible - case 5: return 1; -#else - case 5: return 0; -#endif -#ifdef memory_safe - case 6: return 1; -#else - case 6: return 0; -#endif - case 7: return QLZ_VERSION_MAJOR; - case 8: return QLZ_VERSION_MINOR; - case 9: return QLZ_VERSION_REVISION; - } - return -1; -} - -__inline unsigned int hash_func(unsigned int i) -{ - return ((i >> 12) ^ i) & 0x0fff; -} - -__inline unsigned int fast_read(void const *src, unsigned int bytes) -{ -#ifndef X86X64 - unsigned char *p = (unsigned char*)src; - switch (bytes) - { - case 4: - return(*p | *(p + 1) << 8 | *(p + 2) << 16 | *(p + 3) << 24); - case 3: - return(*p | *(p + 1) << 8 | *(p + 2) << 16); - case 2: - return(*p | *(p + 1) << 8); - case 1: - return(*p); - } - return 0; -#else - if (bytes >= 1 && bytes <= 4) - return *((unsigned int*)src); - else - return 0; -#endif -} - -__inline void fast_write(unsigned int f, void *dst, unsigned int bytes) -{ -#ifndef X86X64 - unsigned char *p = (unsigned char*)dst; - - switch (bytes) - { - case 4: - *p = (unsigned char)f; - *(p + 1) = (unsigned char)(f >> 8); - *(p + 2) = (unsigned char)(f >> 16); - *(p + 3) = (unsigned char)(f >> 24); - return; - case 3: - *p = (unsigned char)f; - *(p + 1) = (unsigned char)(f >> 8); - *(p + 2) = (unsigned char)(f >> 16); - return; - case 2: - *p = (unsigned char)f; - *(p + 1) = (unsigned char)(f >> 8); - return; - case 1: - *p = (unsigned char)f; - return; - } -#else - switch (bytes) - { - case 4: - *((unsigned int*)dst) = f; - return; - case 3: - *((unsigned int*)dst) = f; - return; - case 2: -#if COMPRESSION_LEVEL == 0 -// 2 byte writes are common in level 0 - *((unsigned short int*)dst) = (unsigned short int)f; -#else - *((unsigned int*)dst) = f; -#endif - return; - case 1: - *((unsigned char*)dst) = (unsigned char)f; - return; - } -#endif -} - -__inline void memcpy_up(unsigned char *dst, const unsigned char *src, unsigned int n) -{ - // cannot be replaced by overlap handling of memmove() due to LZSS algorithm -#ifndef X86X64 - - if(n > 8 && src + n < dst) - memcpy(dst, src, n); - else - { - unsigned char *end = dst + n; - while(dst < end) - { - *dst = *src; - dst++; - src++; - } - } -#else - if (n < 5) - *((unsigned int*)dst) = *((unsigned int*)src); - else - { - unsigned char *end = dst + n; - while(dst < end) - { - *((unsigned int*)dst) = *((unsigned int*)src); - dst = dst + 4; - src = src + 4; - } - } -#endif -} - -__inline unsigned int fast_read_safe(void const *src, unsigned int bytes, const unsigned char *invalid) -{ -#ifdef memory_safe - if ((const unsigned char *)src + 4 > (const unsigned char *)invalid) - return 0xffffffff; -#endif - invalid = invalid; - return fast_read(src, bytes); -} - -__inline unsigned int qlz_compress_core(const void *source, unsigned char *destination, unsigned int size, const unsigned char *hashtable[][AND + 1], const unsigned char *first_valid, unsigned char *hash_counter) -{ - const unsigned char *source_c = (const unsigned char*)source; - unsigned char *destination_c = (unsigned char*)destination; - const unsigned char *last_byte = source_c + size - 1; - const unsigned char *src = source_c; - unsigned char *cword_ptr = destination_c; - unsigned char *dst = destination_c + 4; - unsigned int cword_val = 1U << 31; - const unsigned char *guarantee_uncompressed = last_byte - 8; - -#ifdef speedup_incompressible - unsigned char *prev_dst = dst; - const unsigned char *prev_src = src; -#endif - - hash_counter = hash_counter; - first_valid = first_valid; - - // save first 4 bytes uncompressed - while(src < source_c + 4 && src < guarantee_uncompressed) - { - cword_val = (cword_val >> 1); - *dst = *src; - dst++; - src++; - } - - while(src < guarantee_uncompressed) - { - unsigned int fetch; - if ((cword_val & 1) == 1) - { - // check if destinationc pointer could exceed destination buffer - if (dst > destination_c + size) - return 0; - - // store control word - fast_write((cword_val >> 1) | (1U << 31), cword_ptr, 4); - cword_ptr = dst; - dst += 4; - cword_val = 1U << 31; - -#ifdef speedup_incompressible - // check if source chunk is compressible - if (dst - prev_dst > src - prev_src && src > source_c + 1000) - { - int q; - for(q = 0; q < 30 && src + 31 < guarantee_uncompressed && dst + 35 < destination_c + size; q++) - { - -#if(COMPRESSION_LEVEL == 0) - int w; - for(w = 0; w < 31; w++) - { - fetch = fast_read(src + w, 4); - *(unsigned int*)&hashtable[hash_func(fetch)][0] = fast_read(src + w, 4); - hashtable[hash_func(fetch)][1] = src + w; - } -#endif - fast_write((1U << 31), dst - 4, 4); - memcpy(dst, src, 31); - - dst += 4*8 - 1 + 4; - src += 4*8 - 1; - prev_src = src; - prev_dst = dst; - cword_ptr = dst - 4; - } - } -#endif - } -#ifdef test_rle - // check for rle sequence - if (fast_read(src, 4) == fast_read(src + 1, 4)) - { - const unsigned char *orig_src; - fetch = fast_read(src, 4); - orig_src = src; - do src = src + 4; while (src <= guarantee_uncompressed - 4 && fetch == fast_read(src, 4)); - if((src - orig_src) <= 2047) - { - fast_write(((fetch & 0xff) << 16) | (unsigned int)((src - orig_src) << 4) | 15, dst, 4); - dst = dst + 3; - } - else - { - fast_write(((fetch & 0xff) << 16) | 15, dst, 4); - fast_write((unsigned int)(src - orig_src), dst + 3, 4); - dst = dst + 7; - } - cword_val = (cword_val >> 1) | (1 << 31); - } - else -#endif - { - const unsigned char *o; - unsigned int hash, matchlen; - -#if(COMPRESSION_LEVEL < 2) - unsigned int cached; - - fetch = fast_read(src, 4); - hash = hash_func(fetch); - - cached = fetch ^ *(unsigned int*)&hashtable[hash][0]; - *(unsigned int*)&hashtable[hash][0] = fetch; - - o = hashtable[hash][1]; - hashtable[hash][1] = src; - -#else - unsigned char c; - unsigned int k, m; - const unsigned char *offset2 = 0; - - fetch = fast_read(src, 4); - hash = hash_func(fetch); - - matchlen = 0; - c = hash_counter[hash]; - for(k = 0; k < AND + 1; k++) - { - o = hashtable[hash][(c - k) & AND]; - if(o > first_valid && o < src - 3 && *(src + matchlen) == *(o + matchlen) && (fast_read(o, 3) & 0xffffff) == (fetch & 0xffffff) && src - o < 131071) - { - size_t remaining; - remaining = guarantee_uncompressed - src; - m = 3; - if (fast_read(o, 4) == fetch) - { - while(*(o + m) == *(src + m) && m < remaining) - m++; - } - if (m > matchlen) - { - matchlen = m; - offset2 = o; - } - } - } - o = offset2; - c = (hash_counter[hash] + 1) & AND; - hash_counter[hash] = c; - hashtable[hash][c] = src; -#endif - -#if(COMPRESSION_LEVEL == 0) - if (o != 0 && (cached & 0xffffff) == 0 && src - o > 3) -#elif(COMPRESSION_LEVEL == 1) - if ((cached & 0xffffff) == 0 && o > first_valid && o < src - 3 && ((fast_read(o, 3) ^ fast_read(src, 3)) & 0xffffff) == 0 && src - o < 131071) -#elif(COMPRESSION_LEVEL > 1) - if(matchlen == 3) -#endif - { - unsigned int offset; - offset = (unsigned int)(src - o); - -#if(COMPRESSION_LEVEL < 2) - if (cached & 0xffffffff) -#endif - { -#if (COMPRESSION_LEVEL > 2) - unsigned int u; - for(u = 1; u < 3; u++) - { - hash = hash_func(fast_read(src + u, 4)); - c = (hash_counter[hash] + 1) & AND; - hash_counter[hash] = c; - hashtable[hash][c] = src + u; - } -#endif - -#if (COMPRESSION_LEVEL == 0) - cword_val = (cword_val >> 1) | (1U << 31); - fast_write(3 | (hash << 4), dst, 2); - src += 3; - dst += 2; -#else - - if(offset <= 63) - { - // encode lz match - *dst = (unsigned char)(offset << 2); - cword_val = (cword_val >> 1) | (1U << 31); - src += 3; - dst++; - } - else if (offset <= 16383) - { - // encode lz match - unsigned int f = (offset << 2) | 1; - fast_write(f, dst, 2); - cword_val = (cword_val >> 1) | (1U << 31); - src += 3; - dst += 2; - } - else - { - // encode literal - *dst = *src; - src++; - dst++; - cword_val = (cword_val >> 1); - } -#endif - } -#if(COMPRESSION_LEVEL > 1) - } - else if(matchlen > 3) - { -#elif(COMPRESSION_LEVEL < 2) - else -#endif - { - // encode lz match - unsigned int offset; - -#if(COMPRESSION_LEVEL < 2) - const unsigned char *old_src = src; - offset = (unsigned int)(src - o); - cword_val = (cword_val >> 1) | (1U << 31); - - src += 3; - while(*(o + (src - old_src)) == *src && src < guarantee_uncompressed) - src++; - matchlen = (unsigned int)(src - old_src); -#else - unsigned int u; - offset = (unsigned int)(src - o); - cword_val = (cword_val >> 1) | (1U << 31); - -#if (COMPRESSION_LEVEL > 2) - for(u = 1; u < matchlen; u++) -#else - for(u = 1; u < matchlen && u < 5; u++) -#endif - { - hash = hash_func(fast_read(src + u, 4)); - c = (hash_counter[hash] + 1) & AND; - hash_counter[hash] = c; - hashtable[hash][c] = src + u; - } - src += matchlen; -#endif - -#if (COMPRESSION_LEVEL == 0) - if (matchlen < 15) - { - fast_write(matchlen | (hash << 4), dst, 2); - dst += 2; - } - else if (matchlen < 255) - { - fast_write(hash << 4, dst, 2); - *(dst + 2) = (unsigned char)matchlen; - dst += 3; - } - else - { - fast_write(hash << 4, dst, 2); - *(dst + 2) = 0; - fast_write(matchlen, dst + 3, 4); - dst += 7; - } -#else - if (matchlen <= 18 && offset <= 1023) - { - unsigned int f = ((matchlen - 3) << 2) | (offset << 6) | 2; - fast_write(f, dst, 2); - dst += 2; - } - - else if(matchlen <= 34 && offset <= 65535) - { - unsigned int f = ((matchlen - 3) << 3) | (offset << 8) | 3; - fast_write(f, dst, 3); - dst += 3; - } - else if (matchlen >= 3) - { - if (matchlen <= 2050) - { - unsigned int f = ((matchlen - 3) << 4) | (offset << 15) | 7; - fast_write(f, dst, 4); - dst += 4; - } - else - { - fast_write(7, dst, 4); - fast_write(matchlen, dst + 4, 4); - fast_write(offset, dst + 8, 4); - dst += 12; - } - } -#endif - } - } - - else - { - // encode literal - *dst = *src; - src++; - dst++; - cword_val = (cword_val >> 1); - } - } - } - -// save last source bytes as literals - while (src <= last_byte) - { - if ((cword_val & 1) == 1) - { - fast_write((cword_val >> 1) | (1U << 31), cword_ptr, 4); - cword_ptr = dst; - dst += 4; - cword_val = 1U << 31; - } - - if (src < last_byte - 2 && src > source_c + 3) - { - hashtable[hash_func(fast_read(src, 4))][1] = src; - *(unsigned int*)&hashtable[hash_func(fast_read(src, 4))][0] = fast_read(src, 4); - } - *dst = *src; - src++; - dst++; - - cword_val = (cword_val >> 1); - } - - while((cword_val & 1) != 1) - cword_val = (cword_val >> 1); - - fast_write((cword_val >> 1) | (1U << 31), cword_ptr, 4); - - // min. size must be 9 bytes so that the qlz_size functions can take 9 bytes as argument - if (dst - destination_c < 9) - return 9; - else - return (unsigned int)(dst - destination_c); -} - -#if !defined(DECOMPRESSION_ERROR_H) -#define DECOMPRESSION_ERROR_H -// We can't use 0 as error return code, because at 815 line it is used as a success code. -static const size_t DECOMPRESSION_ERROR = (size_t)(-1); -#endif - -__inline size_t qlz_decompress_core(const unsigned char *source, void *destination, size_t size, size_t source_size, unsigned char *first_valid, const unsigned char *hashtable[]) -{ - const unsigned char *source_c = (const unsigned char*)source; - unsigned char *destination_c = (unsigned char*)destination; - const unsigned char *src = source_c; - unsigned char *dst = destination_c; - const unsigned char* last_byte_successor = destination_c + size; - unsigned int cword_val = 1; - const unsigned int bitlut[16] = {4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0}; - const unsigned char *guaranteed_uncompressed = last_byte_successor - 4; - unsigned char *last_hashed = destination_c + 3; - - first_valid = first_valid; - last_hashed = last_hashed; - hashtable = hashtable; - - // prevent spurious memory read on a source with size < 4 - if (dst >= guaranteed_uncompressed) - { - src += 4; - while(dst < last_byte_successor) - { - *dst = *src; - dst++; - src++; - } - - return (unsigned int)(dst - destination_c); - } - - - for(;;) - { - unsigned int fetch; - - if (cword_val == 1) - { - // fetch control word - cword_val = fast_read_safe(src, 4, source_c + source_size) | (1U << 31); - src += 4; - } - - fetch = fast_read_safe(src, 4, source_c + source_size); - - // check if we must decode lz match - if ((cword_val & 1) == 1) - { - unsigned int matchlen; - -#if(COMPRESSION_LEVEL == 0) - unsigned int hash; - const unsigned char *offset2; - - cword_val = cword_val >> 1; - - if((fetch & 0xf) != 15) - { - hash = (fetch >> 4) & 0xfff; - offset2 = hashtable[hash]; - - if((fetch & 0xf) != 0) - { - matchlen = (fetch & 0xf); - src += 2; - } - else if((fetch & 0x00ff0000) != 0) - { - matchlen = *(src + 2); - src += 3; - } - else - { - matchlen = fast_read(src + 3, 4); - src += 7; - } - - // This check prevents segfault for some cases with invalid data. - // not sure about guaranteed_decompressed so assuming at most size bytes (decompressed size) - if (EXPECT_FALSE(dst + matchlen > destination_c + size || offset2 == NULL)) { - return DECOMPRESSION_ERROR; - } - - memcpy_up(dst, offset2, matchlen); - while(last_hashed < dst) - { - last_hashed++; - hashtable[hash_func(fast_read(last_hashed, 4))] = last_hashed; - } - dst += matchlen; - last_hashed = dst - 1; - } - -#else - unsigned int offset; - cword_val = cword_val >> 1; - - if ((fetch & 3) == 0) - { - offset = (fetch & 0xff) >> 2; -#ifdef memory_safe - if (3 > (unsigned int)(guaranteed_uncompressed - dst) || offset > (unsigned int)(dst - first_valid)) - return 0; -#endif - memcpy_up(dst, dst - offset, 3); - dst += 3; - src++; - } - else if ((fetch & 2) == 0) - { - offset = (fetch & 0xffff) >> 2; -#ifdef memory_safe - if (3 > (unsigned int)(guaranteed_uncompressed - dst) || offset > (unsigned int)(dst - first_valid)) - return 0; -#endif - memcpy_up(dst, dst - offset, 3); - dst += 3; - src += 2; - } - else if ((fetch & 1) == 0) - { - offset = (fetch & 0xffff) >> 6; - matchlen = ((fetch >> 2) & 15) + 3; -#ifdef memory_safe - if (matchlen > (unsigned int)(guaranteed_uncompressed - dst) || offset > (unsigned int)(dst - first_valid)) - return 0; -#endif - memcpy_up(dst, dst - offset, matchlen); - src += 2; - dst += matchlen; - } - else if ((fetch & 4) == 0) - { - offset = (fetch & 0xffffff) >> 8; - matchlen = ((fetch >> 3) & 31) + 3; -#ifdef memory_safe - if (matchlen > (unsigned int)(guaranteed_uncompressed - dst) || offset > (unsigned int)(dst - first_valid)) - return 0; -#endif - memcpy_up(dst, dst - offset, matchlen); - src += 3; - dst += matchlen; - } - else if ((fetch & 8) == 0) - { - offset = (fetch >> 15); - if (offset != 0) - { - matchlen = ((fetch >> 4) & 2047) + 3; - src += 4; - } - else - { - matchlen = fast_read_safe(src + 4, 4, source_c + source_size); - offset = fast_read_safe(src + 8, 4, source_c + source_size); - src += 12; - } -#ifdef memory_safe - if (matchlen > (unsigned int)(guaranteed_uncompressed - dst) || offset > (unsigned int)(dst - first_valid)) - return 0; -#endif - memcpy_up(dst, dst - offset, matchlen); - dst += matchlen; - } -#endif - else - { - // decode rle sequence - unsigned char rle_char; - rle_char = (unsigned char)(fetch >> 16); - matchlen = ((fetch >> 4) & 0xfff); - - if(matchlen != 0) - src += 3; - else - { - matchlen = fast_read_safe(src + 3, 4, source_c + source_size); - src += 7; - } - -#ifdef memory_safe - if(matchlen > (unsigned int)(guaranteed_uncompressed - dst)) - return 0; -#endif - memset(dst, rle_char, matchlen); - -#if(COMPRESSION_LEVEL == 0) - while(last_hashed < dst - 1) - { - last_hashed++; - hashtable[hash_func(fast_read(last_hashed, 4))] = last_hashed; - } - last_hashed = dst - 1 + matchlen; -#endif - dst += matchlen; - } - } - else - { - // decode literal -#ifdef memory_safe - if (4 > destination_c + size - dst || src > source_c + source_size + 4) - return 0; -#endif - memcpy_up(dst, src, 4); - - dst += bitlut[cword_val & 0xf]; - src += bitlut[cword_val & 0xf]; - cword_val = cword_val >> (bitlut[cword_val & 0xf]); - -#if(COMPRESSION_LEVEL == 0) - while(last_hashed < dst - 3) - { - last_hashed++; - hashtable[hash_func(fast_read(last_hashed, 4))] = last_hashed; - } -#endif - if (dst >= guaranteed_uncompressed) - { - // decode last literals and exit - while(dst < last_byte_successor) - { - if (cword_val == 1) - { - src += 4; - cword_val = 1U << 31; - } - if (1 > destination_c + size - dst) - return 0; - - *dst = *src; - dst++; - src++; - cword_val = cword_val >> 1; - } - -#if(COMPRESSION_LEVEL == 0) - while(last_hashed < last_byte_successor - 4) - { - last_hashed++; - hashtable[hash_func(fast_read(last_hashed, 4))] = last_hashed; - } -#endif - if((src - 1) - source_c > 8) // 8 bytes comp. size excessive len is ok - return 0; - else if(dst - destination_c - size == 0) - return size; - else - return 0; - } - } - } -} - -size_t qlz_size_decompressed(const char *source) -{ - unsigned int n, r; - n = (((*source) & 2) == 2) ? 4 : 1; - r = fast_read(source + 1 + n, n); - r = r & (0xffffffff >> ((4 - n)*8)); - return r; -} - -size_t qlz_size_compressed(const char *source) -{ - unsigned int n, r; - n = (((*source) & 2) == 2) ? 4 : 1; - r = fast_read(source + 1, n); - r = r & (0xffffffff >> ((4 - n)*8)); - return r; -} - -size_t qlz_compress(const void *source, char *destination, size_t size, char *scratch) -{ - // 1-8 bytes for aligning (not 0-7!); 8 bytes for buffersize (padds on 32 bit cpu); HASH_SIZE hash table; STREAMING_MODE_ROUNDED bytes streambuffer; optional HASH_ENTRIES byte hash counter - unsigned char *buffer_aligned = (unsigned char *)scratch + 8 - (((size_t)scratch) % 8); - const unsigned char *(*hashtable)[AND + 1] = (const unsigned char *(*)[AND + 1])(buffer_aligned + 8); - size_t *buffersize = (size_t *)buffer_aligned; - unsigned char *streambuffer = buffer_aligned + 8 + HASH_SIZE; - unsigned int r; - unsigned int compressed, base; - unsigned char *hash_counter = streambuffer + STREAMING_MODE_ROUNDED; - - if(size == 0 || size > 0xffffffff) - return 0; - -#if (COMPRESSION_LEVEL == 0 && STREAMING_MODE_ROUNDED == 0) - memset((void *)hashtable, 0, HASH_SIZE); -#endif - - if(size < 216) - base = 3; - else - base = 9; - -// if not STREAMING_MODE, then STREAMING_MODE_ROUNDED == 0 and first case (streaming buffer full) is executed unconditionally, functioning as block comp. - if (*buffersize + size - 1 >= STREAMING_MODE_ROUNDED) - { -#if (COMPRESSION_LEVEL == 0 && STREAMING_MODE_ROUNDED != 0) - memset((void *)hashtable, 0, HASH_SIZE); -#endif - - r = base + qlz_compress_core(source, (unsigned char*)destination + base, (unsigned int)size, hashtable, (const unsigned char*)source, hash_counter); -#if (COMPRESSION_LEVEL == 0 && STREAMING_MODE_ROUNDED != 0) - memset((void *)hashtable, 0, HASH_SIZE); -#endif - - if(r == base) - { - memcpy(destination + base, source, size); - r = (unsigned int)size + base; - compressed = 0; - } - else - compressed = 1; - *buffersize = 0; - } - else - { - memcpy(streambuffer + *buffersize, source, size); - r = base + qlz_compress_core(streambuffer + *buffersize, (unsigned char*)destination + base, (unsigned int)size, hashtable, streambuffer, hash_counter); - - if(r == base) - { - memcpy(destination + base, streambuffer + *buffersize, size); - r = (unsigned int)size + base; - compressed = 0; - - memset((void*)hashtable, 0, HASH_SIZE); - } - else - compressed = 1; - *buffersize += size; - } - - if(base == 3) - { - *destination = (unsigned char)(0 | compressed); - *(destination + 1) = (unsigned char)r; - *(destination + 2) = (unsigned char)size; - } - else - { - *destination = (unsigned char)(2 | compressed); - fast_write(r, destination + 1, 4); - fast_write((unsigned int)size, destination + 5, 4); - } - -#if (COMPRESSION_LEVEL == 0) - *destination = (*destination) | 4; -#endif - - return (size_t)r; -} - - -// returns DECOMPRESSION_ERROR in case of an error, or decompressed size on success -size_t qlz_decompress(const char *source, void *destination, char *scratch) -{ - // 1-8 bytes for aligning (not 0-7!); 8 bytes for buffersize (padds on 32bit cpu); STREAMING_MODE_ROUNDED streambuffer; HASH_SIZE hash table - unsigned char *buffer_aligned = (unsigned char *)scratch + 8 - (((size_t)scratch) % 8); - size_t *buffersize = (size_t *)buffer_aligned; - unsigned int headerlen = 2*((((*source) & 2) == 2) ? 4 : 1) + 1; // get header len - - unsigned char *streambuffer = buffer_aligned + 8; - const unsigned char **hashtable = (const unsigned char **)(streambuffer + STREAMING_MODE_ROUNDED); - - size_t dsiz = qlz_size_decompressed((char *)source); - size_t csiz = qlz_size_compressed((char *)source); - if (*buffersize + qlz_size_decompressed((char *)source) - 1 >= STREAMING_MODE_ROUNDED) - { - if((*source & 1) == 1) { - if (qlz_decompress_core((const unsigned char *)source + headerlen, destination, dsiz, csiz, (unsigned char*)destination, hashtable) == DECOMPRESSION_ERROR) { - return DECOMPRESSION_ERROR; - } - } else { - memcpy(destination, source + headerlen, dsiz); - } - *buffersize = 0; - } - else - { - if((*source & 1) == 1) { - if (qlz_decompress_core((const unsigned char *)source + headerlen, streambuffer + *buffersize, dsiz, csiz, streambuffer, hashtable) == DECOMPRESSION_ERROR) { - return DECOMPRESSION_ERROR; - } - } else { - memcpy(streambuffer + *buffersize, source + headerlen, dsiz); - } - memcpy(destination, streambuffer + *buffersize, dsiz); - *buffersize += dsiz; - } - return dsiz; -} - -#undef __inline diff --git a/contrib/libs/quicklz/1.31/yquicklz.h b/contrib/libs/quicklz/1.31/yquicklz.h deleted file mode 100644 index 2dc6c734b2f..00000000000 --- a/contrib/libs/quicklz/1.31/yquicklz.h +++ /dev/null @@ -1,15 +0,0 @@ -#include <sys/types.h> - -#if defined(__cplusplus) -extern "C" { -#endif - -size_t qlz_decompress(const char *source, void *destination, char *scratch); -size_t qlz_compress(const void *source, char *destination, size_t size, char *scratch); -size_t qlz_size_decompressed(const char *source); -size_t qlz_size_compressed(const char *source); -int qlz_get_setting(int setting); - -#if defined(__cplusplus) -} -#endif diff --git a/contrib/libs/quicklz/1.40/quicklz.c b/contrib/libs/quicklz/1.40/quicklz.c deleted file mode 100644 index 1bfe8d00475..00000000000 --- a/contrib/libs/quicklz/1.40/quicklz.c +++ /dev/null @@ -1,829 +0,0 @@ -// QuickLZ data compression library -// Copyright (C) 2006-2007 Lasse Mikkel Reinhold -// lar@quicklz.com -// -// QuickLZ can be used for free under the GPL-1 or GPL-2 license (where anything -// released into public must be open source) or under a commercial license if such -// has been acquired (see http://www.quicklz.com/order.html). The commercial license -// does not cover derived or ported versions created by third parties under GPL. - -// BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION - -#include "quicklz.h" - -#if QLZ_VERSION_MAJOR != 1 || QLZ_VERSION_MINOR != 4 || QLZ_VERSION_REVISION != (-9) -#error quicklz.c and quicklz.h have different versions -#endif - -#if (defined(__X86__) || defined(__i386__) || defined(i386) || defined(_M_IX86) || defined(__386__) || defined(__x86_64__) || defined(_M_X64)) - #define X86X64 -#endif - -#define MINOFFSET 2 -#define UNCONDITIONAL_MATCHLEN 6 -#define UNCOMPRESSED_END 4 -#define CWORD_LEN 4 - -#include <util/system/defaults.h> - -int qlz_get_setting(int setting) -{ - switch (setting) - { - case 0: return QLZ_COMPRESSION_LEVEL; - case 1: return QLZ_SCRATCH_COMPRESS; - case 2: return QLZ_SCRATCH_DECOMPRESS; - case 3: return QLZ_STREAMING_BUFFER; -#ifdef QLZ_MEMORY_SAFE - case 6: return 1; -#else - case 6: return 0; -#endif - case 7: return QLZ_VERSION_MAJOR; - case 8: return QLZ_VERSION_MINOR; - case 9: return QLZ_VERSION_REVISION; - } - return -1; -} - -static void reset_state(unsigned char hash_counter[QLZ_HASH_VALUES]) -{ - memset(hash_counter, 0, QLZ_HASH_VALUES); -} - -static __inline ui32 hash_func(ui32 i) -{ -#if QLZ_COMPRESSION_LEVEL == 2 - return ((i >> 9) ^ (i >> 13) ^ i) & (QLZ_HASH_VALUES - 1); -#else - return ((i >> 12) ^ i) & (QLZ_HASH_VALUES - 1); -#endif -} - -static __inline ui32 fast_read(void const *src, ui32 bytes) -{ -#ifndef X86X64 - unsigned char *p = (unsigned char*)src; - switch (bytes) - { - case 4: - return(*p | *(p + 1) << 8 | *(p + 2) << 16 | *(p + 3) << 24); - case 3: - return(*p | *(p + 1) << 8 | *(p + 2) << 16); - case 2: - return(*p | *(p + 1) << 8); - case 1: - return(*p); - } - return 0; -#else - if (bytes >= 1 && bytes <= 4) - return *((ui32*)src); - else - return 0; -#endif -} - -static __inline void fast_write(ui32 f, void *dst, size_t bytes) -{ -#ifndef X86X64 - unsigned char *p = (unsigned char*)dst; - - switch (bytes) - { - case 4: - *p = (unsigned char)f; - *(p + 1) = (unsigned char)(f >> 8); - *(p + 2) = (unsigned char)(f >> 16); - *(p + 3) = (unsigned char)(f >> 24); - return; - case 3: - *p = (unsigned char)f; - *(p + 1) = (unsigned char)(f >> 8); - *(p + 2) = (unsigned char)(f >> 16); - return; - case 2: - *p = (unsigned char)f; - *(p + 1) = (unsigned char)(f >> 8); - return; - case 1: - *p = (unsigned char)f; - return; - } -#else - switch (bytes) - { - case 4: - *((ui32*)dst) = f; - return; - case 3: - *((ui32*)dst) = f; - return; - case 2: - *((ui16 *)dst) = (ui16)f; - return; - case 1: - *((unsigned char*)dst) = (unsigned char)f; - return; - } -#endif -} - -static __inline void memcpy_up(unsigned char *dst, const unsigned char *src, ui32 n) -{ - // Caution if modifying memcpy_up! Overlap of dst and src must be special handled. -#ifndef X86X64 - unsigned char *end = dst + n; // todo, optimize - while(dst < end) - { - *dst = *src; - dst++; - src++; - } -#else - ui32 f = 0; - do - { - *(ui32 *)(dst + f) = *(ui32 *)(src + f); - f += MINOFFSET + 1; - } - while (f < n); -#endif - } - - -#if QLZ_COMPRESSION_LEVEL <= 2 -static __inline void update_hash(qlz_hash_decompress h[QLZ_HASH_VALUES], unsigned char counter[QLZ_HASH_VALUES], const unsigned char *s) -{ -#if QLZ_COMPRESSION_LEVEL == 1 - ui32 hash, fetch; - fetch = fast_read(s, 3); - hash = hash_func(fetch); - h[hash].offset[0] = s; - counter[hash] = 1; // todo, updating counter -#elif QLZ_COMPRESSION_LEVEL == 2 - ui32 hash, fetch; - unsigned char c; - fetch = fast_read(s, 3); - hash = hash_func(fetch); - c = counter[hash]; - h[hash].offset[c & (QLZ_POINTERS - 1)] = s; - c++; - counter[hash] = c; -#endif -} - -static void update_hash_upto(qlz_hash_decompress h[QLZ_HASH_VALUES], unsigned char counter[QLZ_HASH_VALUES], unsigned char **lh, const unsigned char *max) -{ - while(*lh < max) - { - (*lh)++; - update_hash(h, counter, *lh); - } -} -#endif - -static size_t qlz_compress_core(const unsigned char *source, unsigned char *destination, size_t size, qlz_hash_compress hashtable[QLZ_HASH_VALUES], unsigned char hash_counter[QLZ_HASH_VALUES]) -{ - const unsigned char *last_byte = source + size - 1; - const unsigned char *src = source; - unsigned char *cword_ptr = destination; - unsigned char *dst = destination + CWORD_LEN; - ui32 cword_val = 1U << 31; - const unsigned char *last_matchstart = last_byte - UNCONDITIONAL_MATCHLEN - UNCOMPRESSED_END; - ui32 fetch = 0; - - if(src <= last_matchstart) - fetch = fast_read(src, 3); - - while(src <= last_matchstart) - { - if ((cword_val & 1) == 1) - { - // store uncompressed if compression ratio is too low - if (src > source + 3*(size >> 2) && dst - destination > src - source - ((src - source) >> 5)) - return 0; - - fast_write((cword_val >> 1) | (1U << 31), cword_ptr, CWORD_LEN); - - cword_ptr = dst; - dst += CWORD_LEN; - cword_val = 1U << 31; - fetch = fast_read(src, 3); - } -#if QLZ_COMPRESSION_LEVEL == 1 - { - const unsigned char *o; - ui32 hash, cached; - - hash = hash_func(fetch); - - cached = fetch ^ hashtable[hash].cache[0]; - hashtable[hash].cache[0] = fetch; - - o = hashtable[hash].offset[0]; - hashtable[hash].offset[0] = src; -#ifdef X86X64 - if ((cached & 0xffffff) == 0 && src - o > MINOFFSET && hash_counter[hash] != 0) -#else - if (cached == 0 && src - o > MINOFFSET && hash_counter[hash] != 0) -#endif - { - if (*(o + 3) != *(src + 3)) - { - cword_val = (cword_val >> 1) | (1U << 31); - fast_write((3 - 2) | (hash << 4), dst, 2); - src += 3; - dst += 2; - } - - else - { - const unsigned char *old_src = src; - size_t matchlen; - - cword_val = (cword_val >> 1) | (1U << 31); - src += CWORD_LEN; - - if(*(o + (src - old_src)) == *src) - { - src++; - if(*(o + (src - old_src)) == *src) - { - size_t remaining = (last_byte - UNCOMPRESSED_END - (src - 5) + 1) > 255 ? 255 : (last_byte - UNCOMPRESSED_END - (src - 5) + 1); - src++; - while(*(o + (src - old_src)) == *src && (size_t)(src - old_src) < remaining) - src++; - } - } - - matchlen = src - old_src; - hash <<= 4; - if (matchlen < 18) - { - fast_write((ui32)(matchlen - 2) | hash, dst, 2); - dst += 2; - } - else - { - fast_write((ui32)(matchlen << 16) | hash, dst, 3); - dst += 3; - } - } - fetch = fast_read(src, 3); - } - else - { - hash_counter[hash] = 1; // todo, test if decreasing comp ratio on small input - *dst = *src; - src++; - dst++; - cword_val = (cword_val >> 1); -#ifdef X86X64 - fetch = fast_read(src, 3); -#else - fetch = fetch >> 8 & 0xffff | *(src + 2) << 16; // fast_read(src, 3); -#endif - } - } -#elif QLZ_COMPRESSION_LEVEL >= 2 - { - const unsigned char *o, *offset2; - ui32 hash, matchlen, k, m, best_k; - unsigned char c; - size_t remaining = (last_byte - UNCOMPRESSED_END - src + 1) > 255 ? 255 : (last_byte - UNCOMPRESSED_END - src + 1); - - fetch = fast_read(src, 3); - hash = hash_func(fetch); - - c = hash_counter[hash]; - best_k = 0; - - offset2 = hashtable[hash].offset[0]; - if(offset2 < src - MINOFFSET && c > 0 && ((fast_read(offset2, 3) ^ fetch) & 0xffffff) == 0) // erstattet 2 med MINOFFSET - { - matchlen = 3; - if(*(offset2 + matchlen) == *(src + matchlen)) - { - matchlen = 4; - while(*(offset2 + matchlen) == *(src + matchlen) && matchlen < remaining) - matchlen++; - } - } - else - matchlen = 0; - for(k = 1; k < QLZ_POINTERS && c > k; k++) - { - o = hashtable[hash].offset[k]; -#if QLZ_COMPRESSION_LEVEL == 3 - if(((fast_read(o, 3) ^ fetch) & 0xffffff) == 0 && o < src - MINOFFSET) -#elif QLZ_COMPRESSION_LEVEL == 2 - if(*(src + matchlen) == *(o + matchlen) && ((fast_read(o, 3) ^ fetch) & 0xffffff) == 0 && o < src - MINOFFSET) -#endif - { - m = 3; - while(*(o + m) == *(src + m) && m < remaining) - m++; -#if QLZ_COMPRESSION_LEVEL == 3 - if ((m > matchlen) || (m == matchlen && o > offset2)) -#elif QLZ_COMPRESSION_LEVEL == 2 - if (m > matchlen) -#endif - { - offset2 = o; - matchlen = m; - best_k = k; - } - } - } - o = offset2; - hashtable[hash].offset[c & (QLZ_POINTERS - 1)] = src; - c++; - hash_counter[hash] = c; - -#if QLZ_COMPRESSION_LEVEL == 3 - if(matchlen > 2 && src - o < 131071) - { - // encode lz match - ui32 u; - size_t offset = src - o; - - for(u = 1; u < matchlen; u++) - { - fetch = fast_read(src + u, 3); - hash = hash_func(fetch); - c = hash_counter[hash]++; - hashtable[hash].offset[c & (QLZ_POINTERS - 1)] = src + u; - } - - cword_val = (cword_val >> 1) | (1U << 31); - src += matchlen; - - if(matchlen == 3 && offset <= 63) - { - *dst = (unsigned char)(offset << 2); - dst++; - } - else if (matchlen == 3 && offset <= 16383) - { - ui32 f = (ui32)((offset << 2) | 1); - fast_write(f, dst, 2); - dst += 2; - } - else if (matchlen <= 18 && offset <= 1023) - { - ui32 f = ((matchlen - 3) << 2) | (offset << 6) | 2; - fast_write(f, dst, 2); - dst += 2; - } - - else if(matchlen <= 33) // 1..31 - { - ui32 f = ((matchlen - 2) << 2) | (offset << 7) | 3; - fast_write(f, dst, 3); - dst += 3; - } - else - { - ui32 f = ((matchlen - 3) << 7) | (offset << 15) | 3; - fast_write(f, dst, 4); - dst += 4; - } - } - else - { - *dst = *src; - src++; - dst++; - cword_val = (cword_val >> 1); - } - -#elif QLZ_COMPRESSION_LEVEL == 2 - - if(matchlen > 2) - { - // encode lz match - cword_val = (cword_val >> 1) | (1U << 31); - src += matchlen; - - if (matchlen < 10) - { - ui32 f = best_k | ((matchlen - 2) << 2) | (hash << 5); - fast_write(f, dst, 2); - dst += 2; - } - else - { - ui32 f = best_k | (matchlen << 16) | (hash << 5); - fast_write(f, dst, 3); - dst += 3; - } - } - else - { - // encode literal - *dst = *src; - src++; - dst++; - cword_val = (cword_val >> 1); - } -#endif - } - -#endif - - } - -// save last source bytes as literals - while (src <= last_byte) // todo, kan muligvis forsimples.. - { - if ((cword_val & 1) == 1) - { - fast_write((cword_val >> 1) | (1U << 31), cword_ptr, CWORD_LEN); - cword_ptr = dst; - dst += CWORD_LEN; - cword_val = 1U << 31; - } -#if QLZ_COMPRESSION_LEVEL < 3 - if (src <= last_byte - 3) - { -#if QLZ_COMPRESSION_LEVEL == 1 - ui32 hash, fetch; - fetch = fast_read(src, 3); - hash = hash_func(fetch); - hashtable[hash].offset[0] = src; - hashtable[hash].cache[0] = fetch; - hash_counter[hash] = 1; -#elif QLZ_COMPRESSION_LEVEL == 2 - ui32 hash, fetch; - unsigned char c; - fetch = fast_read(src, 3); - hash = hash_func(fetch); - c = hash_counter[hash]; - hashtable[hash].offset[c & (QLZ_POINTERS - 1)] = src; - c++; - hash_counter[hash] = c; -#endif - } -#endif - *dst = *src; - src++; - dst++; - - cword_val = (cword_val >> 1); - } - - while((cword_val & 1) != 1) - cword_val = (cword_val >> 1); - - fast_write((cword_val >> 1) | (1U << 31), cword_ptr, CWORD_LEN); - - // min. size must be 9 bytes so that the qlz_size functions can take 9 bytes as argument - return dst - destination < 9 ? 9 : dst - destination; -} - -static size_t qlz_decompress_core(const unsigned char *source, unsigned char *destination, size_t size, qlz_hash_decompress hashtable[QLZ_HASH_VALUES], unsigned char hash_counter[QLZ_HASH_VALUES], unsigned char *history, const char *source_2) -{ - const unsigned char *src = source; - unsigned char *dst = destination; - const unsigned char *last_destination_byte = destination + size - 1; - ui32 cword_val = 1; - const ui32 bitlut[16] = {4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0}; - const unsigned char *last_matchstart = last_destination_byte - UNCONDITIONAL_MATCHLEN - UNCOMPRESSED_END; - unsigned char *last_hashed = destination - 1; - const unsigned char *last_source_byte = (const unsigned char *)source_2 + qlz_size_compressed(source_2) - 1; - - (void) last_source_byte; - (void) history; - (void) last_hashed; - (void) hash_counter; - (void) hashtable; - - for(;;) - { - ui32 fetch; - - if (cword_val == 1) - { - // fetch control word -#ifdef QLZ_MEMORY_SAFE - if(src + CWORD_LEN - 1 > last_source_byte) - return 0; -#endif - cword_val = fast_read(src, CWORD_LEN); - src += CWORD_LEN; - } - -#ifdef QLZ_MEMORY_SAFE - if(src + 4 - 1 > last_source_byte) - return 0; -#endif - - fetch = fast_read(src, 4); - - // check if we must decode lz match - if ((cword_val & 1) == 1) - - { - ui32 matchlen; - const unsigned char *offset2; - -#if QLZ_COMPRESSION_LEVEL == 1 - ui32 hash; - cword_val = cword_val >> 1; - hash = (fetch >> 4) & 0xfff; - offset2 = hashtable[hash].offset[0]; - - if((fetch & 0xf) != 0) - { - matchlen = (fetch & 0xf) + 2; - src += 2; - } - else - { - matchlen = *(src + 2); - src += 3; - } - -#elif QLZ_COMPRESSION_LEVEL == 2 - ui32 hash; - unsigned char c; - cword_val = cword_val >> 1; - hash = (fetch >> 5) & 0x7ff; - c = (unsigned char)fetch & 0x3; - offset2 = hashtable[hash].offset[c]; - - if((fetch & (28)) != 0) - { - matchlen = ((fetch >> 2) & 0x7) + 2; - src += 2; - } - else - { - matchlen = *(src + 2); - src += 3; - } - -#elif QLZ_COMPRESSION_LEVEL == 3 - ui32 offset; - cword_val = cword_val >> 1; - if ((fetch & 3) == 0) - { - offset = (fetch & 0xff) >> 2; - matchlen = 3; - src++; - } - else if ((fetch & 2) == 0) - { - offset = (fetch & 0xffff) >> 2; - matchlen = 3; - src += 2; - } - else if ((fetch & 1) == 0) - { - offset = (fetch & 0xffff) >> 6; - matchlen = ((fetch >> 2) & 15) + 3; - src += 2; - } - else if ((fetch & 127) != 3) - { - offset = (fetch >> 7) & 0x1ffff; - matchlen = ((fetch >> 2) & 0x1f) + 2; - src += 3; - } - else - { - offset = (fetch >> 15); - matchlen = ((fetch >> 7) & 255) + 3; - src += 4; - } - - offset2 = dst - offset; -#endif - -#ifdef QLZ_MEMORY_SAFE - if(offset2 < history || offset2 > dst - MINOFFSET - 1) - return 0; - - if(matchlen > (ui32)(last_destination_byte - dst - UNCOMPRESSED_END + 1)) - return 0; -#endif - memcpy_up(dst, offset2, matchlen); - dst += matchlen; - -#if QLZ_COMPRESSION_LEVEL <= 2 - update_hash_upto(hashtable, hash_counter, &last_hashed, dst - matchlen); - last_hashed = dst - 1; -#endif - } - - else - { - // decode literal - if (dst < last_matchstart) - { -#ifdef X86X64 - *(ui32 *)dst = *(ui32 *)src; -#else - memcpy_up(dst, src, 4); -#endif - dst += bitlut[cword_val & 0xf]; - src += bitlut[cword_val & 0xf]; - cword_val = cword_val >> (bitlut[cword_val & 0xf]); -#if QLZ_COMPRESSION_LEVEL <= 2 - update_hash_upto(hashtable, hash_counter, &last_hashed, dst - 3); -#endif - } - else - { - // decode last literals and exit - while(dst <= last_destination_byte) - { - if (cword_val == 1) - { - src += CWORD_LEN; - cword_val = 1U << 31; - } -#ifdef QLZ_MEMORY_SAFE - if(src >= last_source_byte + 1) - return 0; -#endif - *dst = *src; - dst++; - src++; - cword_val = cword_val >> 1; - } - -#if QLZ_COMPRESSION_LEVEL <= 2 - update_hash_upto(hashtable, hash_counter, &last_hashed, last_destination_byte - 3); // todo, use constant -#endif - return size; - } - - } - } -} - -size_t qlz_size_decompressed(const char *source) -{ - ui32 n, r; - n = (((*source) & 2) == 2) ? 4 : 1; - r = fast_read(source + 1 + n, n); - r = r & (0xffffffff >> ((4 - n)*8)); - return r; -} - -size_t qlz_size_compressed(const char *source) -{ - ui32 n, r; - n = (((*source) & 2) == 2) ? 4 : 1; - r = fast_read(source + 1, n); - r = r & (0xffffffff >> ((4 - n)*8)); - return r; -} - -size_t qlz_compress(const void *source, char *destination, size_t size, char *scratch_compress) -{ - unsigned char *scratch_aligned = (unsigned char *)scratch_compress + QLZ_ALIGNMENT_PADD - (((size_t)scratch_compress) % QLZ_ALIGNMENT_PADD); - size_t *buffersize = (size_t *)scratch_aligned; - qlz_hash_compress *hashtable = (qlz_hash_compress *)(scratch_aligned + QLZ_BUFFER_COUNTER); - unsigned char *hash_counter = (unsigned char*)hashtable + sizeof(qlz_hash_compress[QLZ_HASH_VALUES]); -#if QLZ_STREAMING_BUFFER > 0 - unsigned char *streambuffer = hash_counter + QLZ_HASH_VALUES; -#endif - size_t r; - ui32 compressed; - size_t base; - - if(size == 0 || size > 0xffffffff - 400) - return 0; - - if(size < 216) // todo - base = 3; - else - base = 9; - -#if QLZ_STREAMING_BUFFER > 0 - if (*buffersize + size - 1 >= QLZ_STREAMING_BUFFER) -#endif - { - reset_state(hash_counter); - r = base + qlz_compress_core((const unsigned char *)source, (unsigned char*)destination + base, size, hashtable, hash_counter); -#if QLZ_STREAMING_BUFFER > 0 - reset_state(hash_counter); -#endif - if(r == base) - { - memcpy(destination + base, source, size); - r = size + base; - compressed = 0; - } - else - { - compressed = 1; - } - *buffersize = 0; - } -#if QLZ_STREAMING_BUFFER > 0 - else - { - memcpy(streambuffer + *buffersize, source, size); - r = base + qlz_compress_core((const unsigned char *)streambuffer + *buffersize, (unsigned char*)destination + base, size, hashtable, hash_counter); - - if(r == base) - { - memcpy(destination + base, streambuffer + *buffersize, size); - r = size + base; - compressed = 0; - reset_state(hash_counter); - } - else - { - compressed = 1; - } - *buffersize += size; - } -#endif - if(base == 3) - { - *destination = (unsigned char)(0 | compressed); - *(destination + 1) = (unsigned char)r; - *(destination + 2) = (unsigned char)size; - } - else - { - *destination = (unsigned char)(2 | compressed); - fast_write((ui32)r, destination + 1, 4); - fast_write((ui32)size, destination + 5, 4); - } - - *destination |= (QLZ_COMPRESSION_LEVEL << 2); - *destination |= (1 << 6); - *destination |= ((QLZ_STREAMING_BUFFER == 0 ? 0 : (QLZ_STREAMING_BUFFER == 100000 ? 1 : (QLZ_STREAMING_BUFFER == 1000000 ? 2 : 3))) << 4); - -// 76543210 -// 01SSLLHC - - return r; -} - -size_t qlz_decompress(const char *source, void *destination, char *scratch_compress) -{ - unsigned char *scratch_aligned = (unsigned char *)scratch_compress + QLZ_ALIGNMENT_PADD - (((size_t)scratch_compress) % QLZ_ALIGNMENT_PADD); - size_t *buffersize = (size_t *)scratch_aligned; -#if QLZ_COMPRESSION_LEVEL == 3 -#if QLZ_STREAMING_BUFFER > 0 - unsigned char *streambuffer = scratch_aligned + QLZ_BUFFER_COUNTER; -#endif - unsigned char *hash_counter = 0; - qlz_hash_decompress *hashtable = 0; -#elif QLZ_COMPRESSION_LEVEL <= 2 - qlz_hash_decompress *hashtable = (qlz_hash_decompress *)(scratch_aligned + QLZ_BUFFER_COUNTER); - unsigned char *hash_counter = (unsigned char*)hashtable + sizeof(qlz_hash_decompress[QLZ_HASH_VALUES]); -#if QLZ_STREAMING_BUFFER > 0 - unsigned char *streambuffer = hash_counter + QLZ_HASH_VALUES; -#endif -#endif - ui32 headerlen = 2*((((*source) & 2) == 2) ? 4 : 1) + 1; - size_t dsiz = qlz_size_decompressed((char *)source); - -#if QLZ_STREAMING_BUFFER > 0 - if (*buffersize + qlz_size_decompressed((char *)source) - 1 >= QLZ_STREAMING_BUFFER) -#endif - { - if((*source & 1) == 1) - { -#if QLZ_COMPRESSION_LEVEL != 3 - reset_state(hash_counter); -#endif - dsiz = qlz_decompress_core((const unsigned char *)source + headerlen, (unsigned char *)destination, dsiz, hashtable, hash_counter, (unsigned char *)destination, source); - } - else - { - memcpy(destination, source + headerlen, dsiz); - } - *buffersize = 0; -#if QLZ_COMPRESSION_LEVEL != 3 - reset_state(hash_counter); -#endif - } -#if QLZ_STREAMING_BUFFER > 0 - else - { - if((*source & 1) == 1) - { - dsiz = qlz_decompress_core((const unsigned char *)source + headerlen, streambuffer + *buffersize, dsiz, hashtable, hash_counter, streambuffer, source); - } - else - { - memcpy(streambuffer + *buffersize, source + headerlen, dsiz); -#if QLZ_COMPRESSION_LEVEL != 3 - reset_state(hash_counter); -#endif - } - memcpy(destination, streambuffer + *buffersize, dsiz); - *buffersize += dsiz; - } -#endif - return dsiz; -} diff --git a/contrib/libs/quicklz/1.40/quicklz.h b/contrib/libs/quicklz/1.40/quicklz.h deleted file mode 100644 index 87c78a690fd..00000000000 --- a/contrib/libs/quicklz/1.40/quicklz.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef QLZ_HEADER -#define QLZ_HEADER - -// Copyright (C) 2006-2008 Lasse Mikkel Reinhold -// lar@quicklz.com -// -// QuickLZ can be used for free under the GPL-1 or GPL-2 license (where anything -// released into public must be open source) or under a commercial license if such -// has been acquired (see http://www.quicklz.com/order.html). The commercial license -// does not cover derived or ported versions created by third parties under GPL. - -// You can edit following user settings. Note that data must be decompressed with the -// same setting of QLZ_COMPRESSION_LEVEL and QLZ_STREAMING_BUFFER as it was compressed -// (see the manual). First #ifndef makes it possible to define settings from the outside -// like the compiler command line or from higher level code. - -// BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION BETA VERSION - -// Version 1.40 beta 9. Negative revision means beta. -#define QLZ_VERSION_MAJOR 1 -#define QLZ_VERSION_MINOR 4 -#define QLZ_VERSION_REVISION (-9) - -#include "yquicklz.h" - -// Verify compression level -#if QLZ_COMPRESSION_LEVEL != 1 && QLZ_COMPRESSION_LEVEL != 2 && QLZ_COMPRESSION_LEVEL != 3 -#error QLZ_COMPRESSION_LEVEL must be 1, 2 or 3 -#endif - -// Compute QLZ_SCRATCH_COMPRESS and QLZ_SCRATCH_DECOMPRESS -#if QLZ_COMPRESSION_LEVEL == 1 -#define QLZ_POINTERS 1 -#define QLZ_HASH_VALUES 4096 -#elif QLZ_COMPRESSION_LEVEL == 2 -#define QLZ_POINTERS 4 -#define QLZ_HASH_VALUES 2048 -#elif QLZ_COMPRESSION_LEVEL == 3 -#define QLZ_POINTERS 16 -#define QLZ_HASH_VALUES 4096 -#endif - -typedef struct -{ -#if QLZ_COMPRESSION_LEVEL == 1 - unsigned int cache[QLZ_POINTERS]; -#endif - const unsigned char *offset[QLZ_POINTERS]; -} qlz_hash_compress; - -typedef struct -{ - const unsigned char *offset[QLZ_POINTERS]; -} qlz_hash_decompress; - - -#define QLZ_ALIGNMENT_PADD 8 -#define QLZ_BUFFER_COUNTER 8 - -#define QLZ_SCRATCH_COMPRESS QLZ_ALIGNMENT_PADD + QLZ_BUFFER_COUNTER + QLZ_STREAMING_BUFFER + sizeof(qlz_hash_compress[QLZ_HASH_VALUES]) + QLZ_HASH_VALUES - -#if QLZ_COMPRESSION_LEVEL < 3 - #define QLZ_SCRATCH_DECOMPRESS QLZ_ALIGNMENT_PADD + QLZ_BUFFER_COUNTER + QLZ_STREAMING_BUFFER + sizeof(qlz_hash_decompress[QLZ_HASH_VALUES]) + QLZ_HASH_VALUES -#else - #define QLZ_SCRATCH_DECOMPRESS QLZ_ALIGNMENT_PADD + QLZ_BUFFER_COUNTER + QLZ_STREAMING_BUFFER -#endif - -#endif diff --git a/contrib/libs/quicklz/1.40/yquicklz.h b/contrib/libs/quicklz/1.40/yquicklz.h deleted file mode 100644 index eecdff64136..00000000000 --- a/contrib/libs/quicklz/1.40/yquicklz.h +++ /dev/null @@ -1,18 +0,0 @@ -#define QLZ_COMPRESSION_LEVEL COMPRESSION_LEVEL -#define QLZ_STREAMING_BUFFER STREAMING_MODE - -#include <string.h> - -#if defined(__cplusplus) -extern "C" { -#endif - -size_t qlz_size_decompressed(const char *source); -size_t qlz_size_compressed(const char *source); -size_t qlz_decompress(const char *source, void *destination, char *scratch_decompress); -size_t qlz_compress(const void *source, char *destination, size_t size, char *scratch_compress); -int qlz_get_setting(int setting); - -#if defined(__cplusplus) -} -#endif diff --git a/contrib/libs/quicklz/1.51/quicklz.c b/contrib/libs/quicklz/1.51/quicklz.c deleted file mode 100644 index d0615e90dcc..00000000000 --- a/contrib/libs/quicklz/1.51/quicklz.c +++ /dev/null @@ -1,877 +0,0 @@ -// Fast data compression library -// Copyright (C) 2006-2011 Lasse Mikkel Reinhold -// lar@quicklz.com -// -// QuickLZ can be used for free under the GPL 1, 2 or 3 license (where anything -// released into public must be open source) or under a commercial license if such -// has been acquired (see http://www.quicklz.com/order.html). The commercial license -// does not cover derived or ported versions created by third parties under GPL. - -// 1.5.1 BETA 7 - -#include "quicklz.h" -#if defined _MSC_VER - #include <intrin.h> -#endif - -#if QLZ_VERSION_MAJOR != 1 || QLZ_VERSION_MINOR != 5 || QLZ_VERSION_REVISION != 1 - #error quicklz.c and quicklz.h have different versions -#endif - -#if (defined(__X86__) || defined(__i386__) || defined(i386) || defined(_M_IX86) || defined(__386__) || defined(__x86_64__) || defined(_M_X64)) - #define X86X64 -#endif - -#define MINOFFSET 2 -#define UNCONDITIONAL_MATCHLEN_COMPRESSOR 12 -#define UNCONDITIONAL_MATCHLEN_DECOMPRESSOR 6 -#define UNCOMPRESSED_END 4 -#define CWORD_LEN 4 - -#if QLZ_COMPRESSION_LEVEL == 1 && defined QLZ_PTR_64 && QLZ_STREAMING_BUFFER == 0 - #define OFFSET_BASE source - #define CAST (ui32)(size_t) -#else - #define OFFSET_BASE 0 - #define CAST -#endif - -#if defined(X86X64) && (defined(__GNUC__) || defined(__INTEL_COMPILER)) - #define qlz_likely(x) __builtin_expect (x, 1) - #define qlz_unlikely(x) __builtin_expect (x, 0) -#else - #define qlz_likely(x) (x) - #define qlz_unlikely(x) (x) -#endif - -int qlz_get_setting(int setting) -{ - switch (setting) - { - case 0: return QLZ_COMPRESSION_LEVEL; - case 1: return sizeof(qlz_state_compress); - case 2: return sizeof(qlz_state_decompress); - case 3: return QLZ_STREAMING_BUFFER; -#ifdef QLZ_MEMORY_SAFE - case 6: return 1; -#else - case 6: return 0; -#endif - case 7: return QLZ_VERSION_MAJOR; - case 8: return QLZ_VERSION_MINOR; - case 9: return QLZ_VERSION_REVISION; - } - return -1; -} - -#if QLZ_COMPRESSION_LEVEL == 1 -static int same(const unsigned char *src, size_t n) -{ - while(n > 0 && *(src + n) == *src) - n--; - return n == 0 ? 1 : 0; -} -#endif - -static void reset_table_compress(qlz_state_compress *state) -{ - int i; - for(i = 0; i < QLZ_HASH_VALUES; i++) - { -#if QLZ_COMPRESSION_LEVEL == 1 - state->hash[i].offset = 0; -#else - state->hash_counter[i] = 0; -#endif - } -} - -static void reset_table_decompress(qlz_state_decompress *state) -{ - int i; - (void)state; - (void)i; -#if QLZ_COMPRESSION_LEVEL == 2 - for(i = 0; i < QLZ_HASH_VALUES; i++) - { - state->hash_counter[i] = 0; - } -#endif -} - -static __inline ui32 hash_func(ui32 i) -{ -#if QLZ_COMPRESSION_LEVEL == 2 - return ((i >> 9) ^ (i >> 13) ^ i) & (QLZ_HASH_VALUES - 1); -#else - return ((i >> 12) ^ i) & (QLZ_HASH_VALUES - 1); -#endif -} - -static __inline ui32 fast_read(void const *src, ui32 bytes) -{ -#ifndef X86X64 - unsigned char *p = (unsigned char*)src; - switch (bytes) - { - case 4: - return(*p | *(p + 1) << 8 | *(p + 2) << 16 | *(p + 3) << 24); - case 3: - return(*p | *(p + 1) << 8 | *(p + 2) << 16); - case 2: - return(*p | *(p + 1) << 8); - case 1: - return(*p); - } - return 0; -#else - if (bytes >= 1 && bytes <= 4) - return *((ui32*)src); - else - return 0; -#endif -} - -static __inline ui32 hashat(const unsigned char *src) -{ - ui32 fetch, hash; - fetch = fast_read(src, 3); - hash = hash_func(fetch); - return hash; -} - -static __inline void fast_write(ui32 f, void *dst, size_t bytes) -{ -#ifndef X86X64 - unsigned char *p = (unsigned char*)dst; - - switch (bytes) - { - case 4: - *p = (unsigned char)f; - *(p + 1) = (unsigned char)(f >> 8); - *(p + 2) = (unsigned char)(f >> 16); - *(p + 3) = (unsigned char)(f >> 24); - return; - case 3: - *p = (unsigned char)f; - *(p + 1) = (unsigned char)(f >> 8); - *(p + 2) = (unsigned char)(f >> 16); - return; - case 2: - *p = (unsigned char)f; - *(p + 1) = (unsigned char)(f >> 8); - return; - case 1: - *p = (unsigned char)f; - return; - } -#else - switch (bytes) - { - case 4: - *((ui32*)dst) = f; - return; - case 3: - *((ui32*)dst) = f; - return; - case 2: - *((ui16 *)dst) = (ui16)f; - return; - case 1: - *((unsigned char*)dst) = (unsigned char)f; - return; - } -#endif -} - - -size_t qlz_size_decompressed(const char *source) -{ - ui32 n, r; - n = (((*source) & 2) == 2) ? 4 : 1; - r = fast_read(source + 1 + n, n); - r = r & (0xffffffff >> ((4 - n)*8)); - return r; -} - -size_t qlz_size_compressed(const char *source) -{ - ui32 n, r; - n = (((*source) & 2) == 2) ? 4 : 1; - r = fast_read(source + 1, n); - r = r & (0xffffffff >> ((4 - n)*8)); - return r; -} - -size_t qlz_size_header(const char *source) -{ - size_t n = 2*((((*source) & 2) == 2) ? 4 : 1) + 1; - return n; -} - - -static __inline void memcpy_up(unsigned char *dst, const unsigned char *src, ui32 n) -{ - // Caution if modifying memcpy_up! Overlap of dst and src must be special handled. -#ifndef X86X64 - unsigned char *end = dst + n; - while(dst < end) - { - *dst = *src; - dst++; - src++; - } -#else - ui32 f = 0; - do - { - *(ui32 *)(dst + f) = *(ui32 *)(src + f); - f += MINOFFSET + 1; - } - while (f < n); -#endif -} - -static __inline void update_hash(qlz_state_decompress *state, const unsigned char *s) -{ -#if QLZ_COMPRESSION_LEVEL == 1 - ui32 hash; - hash = hashat(s); - state->hash[hash].offset = s; - state->hash_counter[hash] = 1; -#elif QLZ_COMPRESSION_LEVEL == 2 - ui32 hash; - unsigned char c; - hash = hashat(s); - c = state->hash_counter[hash]; - state->hash[hash].offset[c & (QLZ_POINTERS - 1)] = s; - c++; - state->hash_counter[hash] = c; -#endif - (void)state; - (void)s; -} - -#if QLZ_COMPRESSION_LEVEL <= 2 -static void update_hash_upto(qlz_state_decompress *state, unsigned char **lh, const unsigned char *max) -{ - while(*lh < max) - { - (*lh)++; - update_hash(state, *lh); - } -} -#endif - -static size_t qlz_compress_core(const unsigned char *source, unsigned char *destination, size_t size, qlz_state_compress *state) -{ - const unsigned char *last_byte = source + size - 1; - const unsigned char *src = source; - unsigned char *cword_ptr = destination; - unsigned char *dst = destination + CWORD_LEN; - ui32 cword_val = 1U << 31; - const unsigned char *last_matchstart = last_byte - UNCONDITIONAL_MATCHLEN_COMPRESSOR - UNCOMPRESSED_END; - ui32 fetch = 0; - unsigned int lits = 0; - - (void) lits; - - if(src <= last_matchstart) - fetch = fast_read(src, 3); - - while(qlz_likely(src <= last_matchstart)) - { - if (qlz_unlikely( (cword_val & 1) == 1)) - { - // store uncompressed if compression ratio is too low - if (src > source + (size >> 1) && dst - destination > src - source - ((src - source) >> 5)) - return 0; - - fast_write((cword_val >> 1) | (1U << 31), cword_ptr, CWORD_LEN); - - cword_ptr = dst; - dst += CWORD_LEN; - cword_val = 1U << 31; - fetch = fast_read(src, 3); - } -#if QLZ_COMPRESSION_LEVEL == 1 - { - const unsigned char *o; - ui32 hash, cached; - - hash = hash_func(fetch); - cached = fetch ^ state->hash[hash].cache; - state->hash[hash].cache = fetch; - - o = state->hash[hash].offset + OFFSET_BASE; - state->hash[hash].offset = CAST(src - OFFSET_BASE); -#ifdef X86X64 - if ((cached & 0xffffff) == 0 && o != OFFSET_BASE && (src - o > MINOFFSET || (src == o + 1 && lits >= 3 && src > source + 3 && same(src - 3, 6)))) - { -#else - if (cached == 0 && o != OFFSET_BASE && (src - o > MINOFFSET || (src == o + 1 && lits >= 3 && src > source + 3 && same(src - 3, 6)))) - { -#endif - size_t matchlen = 3; - hash <<= 4; - cword_val = (cword_val >> 1) | (1U << 31); - -#if defined X86X64 && defined QLZ_PTR_64 - { -#ifdef __GNUC__ - unsigned long long a = *(unsigned long long *)(src + matchlen); - unsigned long long b = *(unsigned long long *)(o + matchlen); - unsigned long long c = a^b; -#else - unsigned int a = *(unsigned int *)(src + matchlen); - unsigned int b = *(unsigned int *)(o + matchlen); - unsigned int c = a^b; -#endif - if(qlz_unlikely(c == 0)) - { - size_t q = last_byte - UNCOMPRESSED_END - src + 1; - size_t remaining = q > 255 ? 255 : q; - matchlen += sizeof(c); - while(src[matchlen] == o[matchlen] && matchlen < remaining) - matchlen++; - } - else - { -#if defined _MSC_VER || (defined(__INTEL_COMPILER) && !defined(__GNUC__)) - unsigned int index = 0; - _BitScanForward((unsigned long *)&index, c); - matchlen += index >> 3; -#else - matchlen += __builtin_ctzll(c) >> 3; -#endif - } - } -#else - if(src[matchlen] == o[matchlen]) - { - size_t q = last_byte - UNCOMPRESSED_END - src + 1; - size_t remaining = q > 255 ? 255 : q; - matchlen ++; - while(src[matchlen] == o[matchlen] && matchlen < remaining) - matchlen++; - } -#endif - src += matchlen; - - if (qlz_likely(matchlen < 18)) - { - fast_write((ui32)(matchlen - 2) | hash, dst, 2); - dst += 2; - } - else - { - fast_write((ui32)(matchlen << 16) | hash, dst, 3); - dst += 3; - } - - fetch = fast_read(src, 3); - lits = 0; - } - else - { - lits++; - *dst = *src; - src++; - dst++; - cword_val = (cword_val >> 1); -#ifdef X86X64 - fetch = fast_read(src, 3); -#else - fetch = (fetch >> 8 & 0xffff) | (*(src + 2) << 16); -#endif - } - } -#elif QLZ_COMPRESSION_LEVEL >= 2 - { - const unsigned char *o, *offset2; - ui32 hash, matchlen, k, m, best_k = 0; - unsigned char c; - size_t remaining = (last_byte - UNCOMPRESSED_END - src + 1) > 255 ? 255 : (last_byte - UNCOMPRESSED_END - src + 1); - (void)best_k; - - fetch = fast_read(src, 3); - hash = hash_func(fetch); - - c = state->hash_counter[hash]; - - offset2 = state->hash[hash].offset[0]; - if(offset2 < src - MINOFFSET && c > 0 && ((fast_read(offset2, 3) ^ fetch) & 0xffffff) == 0) - { - matchlen = 3; - if(*(offset2 + matchlen) == *(src + matchlen)) - { - matchlen = 4; - while(*(offset2 + matchlen) == *(src + matchlen) && matchlen < remaining) - matchlen++; - } - } - else - matchlen = 0; - for(k = 1; k < QLZ_POINTERS && c > k; k++) - { - o = state->hash[hash].offset[k]; -#if QLZ_COMPRESSION_LEVEL == 3 - if(((fast_read(o, 3) ^ fetch) & 0xffffff) == 0 && o < src - MINOFFSET) -#elif QLZ_COMPRESSION_LEVEL == 2 - if(*(src + matchlen) == *(o + matchlen) && ((fast_read(o, 3) ^ fetch) & 0xffffff) == 0 && o < src - MINOFFSET) -#endif - { - m = 3; - while(*(o + m) == *(src + m) && m < remaining) - m++; -#if QLZ_COMPRESSION_LEVEL == 3 - if ((m > matchlen) || (m == matchlen && o > offset2)) -#elif QLZ_COMPRESSION_LEVEL == 2 - if (m > matchlen) -#endif - { - offset2 = o; - matchlen = m; - best_k = k; - } - } - } - o = offset2; - state->hash[hash].offset[c & (QLZ_POINTERS - 1)] = src; - c++; - state->hash_counter[hash] = c; - -#if QLZ_COMPRESSION_LEVEL == 3 - if(matchlen > 2 && src - o < 131071) - { - ui32 u; - size_t offset = src - o; - - for(u = 1; u < matchlen; u++) - { - hash = hashat(src + u); - c = state->hash_counter[hash]++; - state->hash[hash].offset[c & (QLZ_POINTERS - 1)] = src + u; - } - - cword_val = (cword_val >> 1) | (1U << 31); - src += matchlen; - - if(matchlen == 3 && offset <= 63) - { - *dst = (unsigned char)(offset << 2); - dst++; - } - else if (matchlen == 3 && offset <= 16383) - { - ui32 f = (ui32)((offset << 2) | 1); - fast_write(f, dst, 2); - dst += 2; - } - else if (matchlen <= 18 && offset <= 1023) - { - ui32 f = ((matchlen - 3) << 2) | ((ui32)offset << 6) | 2; - fast_write(f, dst, 2); - dst += 2; - } - - else if(matchlen <= 33) - { - ui32 f = ((matchlen - 2) << 2) | ((ui32)offset << 7) | 3; - fast_write(f, dst, 3); - dst += 3; - } - else - { - ui32 f = ((matchlen - 3) << 7) | ((ui32)offset << 15) | 3; - fast_write(f, dst, 4); - dst += 4; - } - } - else - { - *dst = *src; - src++; - dst++; - cword_val = (cword_val >> 1); - } -#elif QLZ_COMPRESSION_LEVEL == 2 - - if(matchlen > 2) - { - cword_val = (cword_val >> 1) | (1U << 31); - src += matchlen; - - if (matchlen < 10) - { - ui32 f = best_k | ((matchlen - 2) << 2) | (hash << 5); - fast_write(f, dst, 2); - dst += 2; - } - else - { - ui32 f = best_k | (matchlen << 16) | (hash << 5); - fast_write(f, dst, 3); - dst += 3; - } - } - else - { - *dst = *src; - src++; - dst++; - cword_val = (cword_val >> 1); - } -#endif - } -#endif - } - while (src <= last_byte) - { - if ((cword_val & 1) == 1) - { - fast_write((cword_val >> 1) | (1U << 31), cword_ptr, CWORD_LEN); - cword_ptr = dst; - dst += CWORD_LEN; - cword_val = 1U << 31; - } -#if QLZ_COMPRESSION_LEVEL < 3 - if (src <= last_byte - 3) - { -#if QLZ_COMPRESSION_LEVEL == 1 - ui32 hash, fetch; - fetch = fast_read(src, 3); - hash = hash_func(fetch); - state->hash[hash].offset = CAST(src - OFFSET_BASE); - state->hash[hash].cache = fetch; -#elif QLZ_COMPRESSION_LEVEL == 2 - ui32 hash; - unsigned char c; - hash = hashat(src); - c = state->hash_counter[hash]; - state->hash[hash].offset[c & (QLZ_POINTERS - 1)] = src; - c++; - state->hash_counter[hash] = c; -#endif - } -#endif - *dst = *src; - src++; - dst++; - cword_val = (cword_val >> 1); - } - - while((cword_val & 1) != 1) - cword_val = (cword_val >> 1); - - fast_write((cword_val >> 1) | (1U << 31), cword_ptr, CWORD_LEN); - - // min. size must be 9 bytes so that the qlz_size functions can take 9 bytes as argument - return dst - destination < 9 ? 9 : dst - destination; -} - -static size_t qlz_decompress_core(const unsigned char *source, unsigned char *destination, size_t size, qlz_state_decompress *state, const unsigned char *history) -{ - const unsigned char *src = source + qlz_size_header((const char *)source); - unsigned char *dst = destination; - const unsigned char *last_destination_byte = destination + size - 1; - ui32 cword_val = 1; - const unsigned char *last_matchstart = last_destination_byte - UNCONDITIONAL_MATCHLEN_DECOMPRESSOR - UNCOMPRESSED_END; - unsigned char *last_hashed = destination - 1; - const unsigned char *last_source_byte = source + qlz_size_compressed((const char *)source) - 1; - static const ui32 bitlut[16] = {4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0}; - - (void) last_source_byte; - (void) last_hashed; - (void) state; - (void) history; - - for(;;) - { - ui32 fetch; - - if (cword_val == 1) - { -#ifdef QLZ_MEMORY_SAFE - if(src + CWORD_LEN - 1 > last_source_byte) - return 0; -#endif - cword_val = fast_read(src, CWORD_LEN); - src += CWORD_LEN; - } - -#ifdef QLZ_MEMORY_SAFE - if(src + 4 - 1 > last_source_byte) - return 0; -#endif - - fetch = fast_read(src, 4); - - if ((cword_val & 1) == 1) - { - ui32 matchlen; - const unsigned char *offset2; - -#if QLZ_COMPRESSION_LEVEL == 1 - ui32 hash; - cword_val = cword_val >> 1; - hash = (fetch >> 4) & 0xfff; - offset2 = (const unsigned char *)(size_t)state->hash[hash].offset; - - if((fetch & 0xf) != 0) - { - matchlen = (fetch & 0xf) + 2; - src += 2; - } - else - { - matchlen = *(src + 2); - src += 3; - } - -#elif QLZ_COMPRESSION_LEVEL == 2 - ui32 hash; - unsigned char c; - cword_val = cword_val >> 1; - hash = (fetch >> 5) & 0x7ff; - c = (unsigned char)(fetch & 0x3); - offset2 = state->hash[hash].offset[c]; - - if((fetch & (28)) != 0) - { - matchlen = ((fetch >> 2) & 0x7) + 2; - src += 2; - } - else - { - matchlen = *(src + 2); - src += 3; - } - -#elif QLZ_COMPRESSION_LEVEL == 3 - ui32 offset; - cword_val = cword_val >> 1; - if ((fetch & 3) == 0) - { - offset = (fetch & 0xff) >> 2; - matchlen = 3; - src++; - } - else if ((fetch & 2) == 0) - { - offset = (fetch & 0xffff) >> 2; - matchlen = 3; - src += 2; - } - else if ((fetch & 1) == 0) - { - offset = (fetch & 0xffff) >> 6; - matchlen = ((fetch >> 2) & 15) + 3; - src += 2; - } - else if ((fetch & 127) != 3) - { - offset = (fetch >> 7) & 0x1ffff; - matchlen = ((fetch >> 2) & 0x1f) + 2; - src += 3; - } - else - { - offset = (fetch >> 15); - matchlen = ((fetch >> 7) & 255) + 3; - src += 4; - } - - offset2 = dst - offset; -#endif - -#ifdef QLZ_MEMORY_SAFE - if(offset2 < history || offset2 > dst - MINOFFSET - 1) - return 0; - - if(matchlen > (ui32)(last_destination_byte - dst - UNCOMPRESSED_END + 1)) - return 0; -#endif - - memcpy_up(dst, offset2, matchlen); - dst += matchlen; - -#if QLZ_COMPRESSION_LEVEL <= 2 - update_hash_upto(state, &last_hashed, dst - matchlen); - last_hashed = dst - 1; -#endif - } - else - { - if (dst < last_matchstart) - { - unsigned int n = bitlut[cword_val & 0xf]; -#ifdef X86X64 - *(ui32 *)dst = *(ui32 *)src; -#else - memcpy_up(dst, src, 4); -#endif - cword_val = cword_val >> n; - dst += n; - src += n; -#if QLZ_COMPRESSION_LEVEL <= 2 - update_hash_upto(state, &last_hashed, dst - 3); -#endif - } - else - { - while(dst <= last_destination_byte) - { - if (cword_val == 1) - { - src += CWORD_LEN; - cword_val = 1U << 31; - } -#ifdef QLZ_MEMORY_SAFE - if(src >= last_source_byte + 1) - return 0; -#endif - *dst = *src; - dst++; - src++; - cword_val = cword_val >> 1; - } - -#if QLZ_COMPRESSION_LEVEL <= 2 - update_hash_upto(state, &last_hashed, last_destination_byte - 3); // todo, use constant -#endif - return size; - } - - } - } -} - -size_t qlz_compress(const void *source, char *destination, size_t size, qlz_state_compress *state) -{ - size_t r; - ui32 compressed; - size_t base; - - if(size == 0 || size > 0xffffffff - 400) - return 0; - - if(size < 216) - base = 3; - else - base = 9; - -#if QLZ_STREAMING_BUFFER > 0 - if (state->stream_counter + size - 1 >= QLZ_STREAMING_BUFFER) -#endif - { - reset_table_compress(state); - r = base + qlz_compress_core((const unsigned char *)source, (unsigned char*)destination + base, size, state); -#if QLZ_STREAMING_BUFFER > 0 - reset_table_compress(state); -#endif - if(r == base) - { - memcpy(destination + base, source, size); - r = size + base; - compressed = 0; - } - else - { - compressed = 1; - } - state->stream_counter = 0; - } -#if QLZ_STREAMING_BUFFER > 0 - else - { - unsigned char *src = state->stream_buffer + state->stream_counter; - - memcpy(src, source, size); - r = base + qlz_compress_core(src, (unsigned char*)destination + base, size, state); - - if(r == base) - { - memcpy(destination + base, src, size); - r = size + base; - compressed = 0; - reset_table_compress(state); - } - else - { - compressed = 1; - } - state->stream_counter += size; - } -#endif - if(base == 3) - { - *destination = (unsigned char)(0 | compressed); - *(destination + 1) = (unsigned char)r; - *(destination + 2) = (unsigned char)size; - } - else - { - *destination = (unsigned char)(2 | compressed); - fast_write((ui32)r, destination + 1, 4); - fast_write((ui32)size, destination + 5, 4); - } - - *destination |= (QLZ_COMPRESSION_LEVEL << 2); - *destination |= (1 << 6); - *destination |= ((QLZ_STREAMING_BUFFER == 0 ? 0 : (QLZ_STREAMING_BUFFER == 100000 ? 1 : (QLZ_STREAMING_BUFFER == 1000000 ? 2 : 3))) << 4); - -// 76543210 -// 01SSLLHC - - return r; -} - -size_t qlz_decompress(const char *source, void *destination, qlz_state_decompress *state) -{ - size_t dsiz = qlz_size_decompressed(source); - size_t csiz = qlz_size_compressed(source); - -#if QLZ_STREAMING_BUFFER > 0 - if (state->stream_counter + qlz_size_decompressed(source) - 1 >= QLZ_STREAMING_BUFFER) -#endif - { - if((*source & 1) == 1) - { - reset_table_decompress(state); - dsiz = qlz_decompress_core((const unsigned char *)source, (unsigned char *)destination, dsiz, state, (const unsigned char *)destination); - } - else - { - if(csiz != dsiz + qlz_size_header(source)) - return 0; - - memcpy(destination, source + qlz_size_header(source), dsiz); - } - state->stream_counter = 0; - reset_table_decompress(state); - } -#if QLZ_STREAMING_BUFFER > 0 - else - { - unsigned char *dst = state->stream_buffer + state->stream_counter; - if((*source & 1) == 1) - { - dsiz = qlz_decompress_core((const unsigned char *)source, dst, dsiz, state, (const unsigned char *)state->stream_buffer); - } - else - { - // if(csiz != dsiz + qlz_size_header(source)) - // return 0; - - memcpy(dst, source + qlz_size_header(source), dsiz); - reset_table_decompress(state); - } - memcpy(destination, dst, dsiz); - state->stream_counter += dsiz; - } -#endif - return dsiz; -} - diff --git a/contrib/libs/quicklz/1.51/quicklz.h b/contrib/libs/quicklz/1.51/quicklz.h deleted file mode 100644 index b202deb98a1..00000000000 --- a/contrib/libs/quicklz/1.51/quicklz.h +++ /dev/null @@ -1,139 +0,0 @@ -#ifndef QLZ_HEADER -#define QLZ_HEADER - -// Fast data compression library -// Copyright (C) 2006-2011 Lasse Mikkel Reinhold -// lar@quicklz.com -// -// QuickLZ can be used for free under the GPL 1, 2 or 3 license (where anything -// released into public must be open source) or under a commercial license if such -// has been acquired (see http://www.quicklz.com/order.html). The commercial license -// does not cover derived or ported versions created by third parties under GPL. - -// You can edit following user settings. Data must be decompressed with the same -// setting of QLZ_COMPRESSION_LEVEL and QLZ_STREAMING_BUFFER as it was compressed -// (see manual). First #ifndef makes it possible to define settings from -// the outside like the compiler command line. - -// 1.5.1 BETA 7 - -#ifndef QLZ_COMPRESSION_LEVEL - #define QLZ_COMPRESSION_LEVEL 1 - //#define QLZ_COMPRESSION_LEVEL 2 - //#define QLZ_COMPRESSION_LEVEL 3 - - #define QLZ_STREAMING_BUFFER 0 - //#define QLZ_STREAMING_BUFFER 100000 - //#define QLZ_STREAMING_BUFFER 1000000 - - //#define QLZ_MEMORY_SAFE -#endif - -#define QLZ_VERSION_MAJOR 1 -#define QLZ_VERSION_MINOR 5 -#define QLZ_VERSION_REVISION 1 - -// Using size_t, memset() and memcpy() -#include <string.h> - -// Verify compression level -#if QLZ_COMPRESSION_LEVEL != 1 && QLZ_COMPRESSION_LEVEL != 2 && QLZ_COMPRESSION_LEVEL != 3 -#error QLZ_COMPRESSION_LEVEL must be 1, 2 or 3 -#endif - -// Decrease QLZ_POINTERS for level 3 to increase compression speed. Do not touch any other values! -#if QLZ_COMPRESSION_LEVEL == 1 -#define QLZ_POINTERS 1 -#define QLZ_HASH_VALUES 4096 -#elif QLZ_COMPRESSION_LEVEL == 2 -#define QLZ_POINTERS 4 -#define QLZ_HASH_VALUES 2048 -#elif QLZ_COMPRESSION_LEVEL == 3 -#define QLZ_POINTERS 16 -#define QLZ_HASH_VALUES 4096 -#endif - -// Detect if pointer size is 64-bit. It's not fatal if some 64-bit target is not detected because this is only for adding an optional 64-bit optimization. -#if defined _LP64 || defined __LP64__ || defined __64BIT__ || _ADDR64 || defined _WIN64 || defined __arch64__ || __WORDSIZE == 64 || (defined __sparc && defined __sparcv9) || defined __x86_64 || defined __amd64 || defined __x86_64__ || defined _M_X64 || defined _M_IA64 || defined __ia64 || defined __IA64__ - #define QLZ_PTR_64 -#endif - -// hash entry -typedef struct -{ -#if QLZ_COMPRESSION_LEVEL == 1 - ui32 cache; -#if defined QLZ_PTR_64 && QLZ_STREAMING_BUFFER == 0 - unsigned int offset; -#else - const unsigned char *offset; -#endif -#else - const unsigned char *offset[QLZ_POINTERS]; -#endif - -} qlz_hash_compress; - -typedef struct -{ -#if QLZ_COMPRESSION_LEVEL == 1 - const unsigned char *offset; -#else - const unsigned char *offset[QLZ_POINTERS]; -#endif -} qlz_hash_decompress; - - -// states -typedef struct -{ - #if QLZ_STREAMING_BUFFER > 0 - unsigned char stream_buffer[QLZ_STREAMING_BUFFER]; - #endif - size_t stream_counter; - qlz_hash_compress hash[QLZ_HASH_VALUES]; - unsigned char hash_counter[QLZ_HASH_VALUES]; -} qlz_state_compress; - - -#if QLZ_COMPRESSION_LEVEL == 1 || QLZ_COMPRESSION_LEVEL == 2 - typedef struct - { -#if QLZ_STREAMING_BUFFER > 0 - unsigned char stream_buffer[QLZ_STREAMING_BUFFER]; -#endif - qlz_hash_decompress hash[QLZ_HASH_VALUES]; - unsigned char hash_counter[QLZ_HASH_VALUES]; - size_t stream_counter; - } qlz_state_decompress; -#elif QLZ_COMPRESSION_LEVEL == 3 - typedef struct - { -#if QLZ_STREAMING_BUFFER > 0 - unsigned char stream_buffer[QLZ_STREAMING_BUFFER]; -#endif -#if QLZ_COMPRESSION_LEVEL <= 2 - qlz_hash_decompress hash[QLZ_HASH_VALUES]; -#endif - size_t stream_counter; - } qlz_state_decompress; -#endif - - -#if defined (__cplusplus) -extern "C" { -#endif - -// Public functions of QuickLZ -size_t qlz_size_decompressed(const char *source); -size_t qlz_size_compressed(const char *source); -size_t qlz_compress(const void *source, char *destination, size_t size, qlz_state_compress *state); -size_t qlz_decompress(const char *source, void *destination, qlz_state_decompress *state); -int qlz_get_setting(int setting); - -#if defined (__cplusplus) -} -#endif - -#endif - diff --git a/contrib/libs/quicklz/1.51/tables.c b/contrib/libs/quicklz/1.51/tables.c deleted file mode 100644 index 8ec68ab034f..00000000000 --- a/contrib/libs/quicklz/1.51/tables.c +++ /dev/null @@ -1,10 +0,0 @@ -#include <util/system/defaults.h> -//typedef unsigned int ui32; -//typedef unsigned short int ui16; - -#include "table.h" -#include "tables.inc" - -struct TQuickLZMethods* GetLzq151Table(unsigned level, unsigned buf) { - return methods_qlz151[level][buf]; -} diff --git a/contrib/libs/quicklz/1.51/tables.inc b/contrib/libs/quicklz/1.51/tables.inc deleted file mode 100644 index 9ffd71e4ab0..00000000000 --- a/contrib/libs/quicklz/1.51/tables.inc +++ /dev/null @@ -1,33 +0,0 @@ -#define COMPRESSION_LEVEL 1 -#define STREAMING_MODE 0 -#include "y.c" -#define COMPRESSION_LEVEL 1 -#define STREAMING_MODE 100000 -#include "y.c" -#define COMPRESSION_LEVEL 1 -#define STREAMING_MODE 1000000 -#include "y.c" -#define COMPRESSION_LEVEL 2 -#define STREAMING_MODE 0 -#include "y.c" -#define COMPRESSION_LEVEL 2 -#define STREAMING_MODE 100000 -#include "y.c" -#define COMPRESSION_LEVEL 2 -#define STREAMING_MODE 1000000 -#include "y.c" -#define COMPRESSION_LEVEL 3 -#define STREAMING_MODE 0 -#include "y.c" -#define COMPRESSION_LEVEL 3 -#define STREAMING_MODE 100000 -#include "y.c" -#define COMPRESSION_LEVEL 3 -#define STREAMING_MODE 1000000 -#include "y.c" -static struct TQuickLZMethods* methods_qlz151[3][3] = { -{&yqlz_1_51_1_0_table, &yqlz_1_51_1_100000_table, &yqlz_1_51_1_1000000_table, }, -{&yqlz_1_51_2_0_table, &yqlz_1_51_2_100000_table, &yqlz_1_51_2_1000000_table, }, -{&yqlz_1_51_3_0_table, &yqlz_1_51_3_100000_table, &yqlz_1_51_3_1000000_table, }, -}; - diff --git a/contrib/libs/quicklz/1.51/y.c b/contrib/libs/quicklz/1.51/y.c deleted file mode 100644 index 7d81f7dd18f..00000000000 --- a/contrib/libs/quicklz/1.51/y.c +++ /dev/null @@ -1,52 +0,0 @@ -#define QLZ_COMPRESSION_LEVEL COMPRESSION_LEVEL -#define QLZ_STREAMING_BUFFER STREAMING_MODE -#define QLZ_YVERSION 1_51 - -#include "prolog.h" -#include "quicklz.c" - -#define STR(a) STR2(a) -#define STR2(a) STR3(a) -#define STR3(a) #a - -static struct TQuickLZMethods qlz_table = { - qlz_size_decompressed, - qlz_size_compressed, - qlz_decompress, - qlz_compress, - qlz_get_setting, - STR(QLZ_YVERSION) "-" STR(COMPRESSION_LEVEL) "-" STR(STREAMING_MODE) -}; - -#include "epilog.h" - -#undef STR -#undef STR2 -#undef STR3 -#undef X86X64 -#undef MINOFFSET -#undef UNCONDITIONAL_MATCHLEN_COMPRESSOR -#undef UNCONDITIONAL_MATCHLEN_DECOMPRESSOR -#undef UNCOMPRESSED_END -#undef CWORD_LEN -#undef OFFSET_BASE -#undef CAST -#undef OFFSET_BASE -#undef CAST -#undef qlz_likely -#undef qlz_unlikely -#undef qlz_likely -#undef qlz_unlikely -#undef QLZ_HEADER -#undef QLZ_COMPRESSION_LEVEL -#undef QLZ_STREAMING_BUFFER -#undef QLZ_VERSION_MAJOR -#undef QLZ_VERSION_MINOR -#undef QLZ_VERSION_REVISION -#undef QLZ_POINTERS -#undef QLZ_HASH_VALUES -#undef QLZ_POINTERS -#undef QLZ_HASH_VALUES -#undef QLZ_POINTERS -#undef QLZ_HASH_VALUES -#undef QLZ_PTR_64 diff --git a/contrib/libs/quicklz/1_31_0_0.c b/contrib/libs/quicklz/1_31_0_0.c deleted file mode 100644 index a3d66f0f44d..00000000000 --- a/contrib/libs/quicklz/1_31_0_0.c +++ /dev/null @@ -1,4 +0,0 @@ -#define FROM_QUICKLZ_BUILD -#include "1_31_0_0.h" -#include "1.31/quicklz.c" -#include "table.inc" diff --git a/contrib/libs/quicklz/1_31_0_0.h b/contrib/libs/quicklz/1_31_0_0.h deleted file mode 100644 index af8a7b977f2..00000000000 --- a/contrib/libs/quicklz/1_31_0_0.h +++ /dev/null @@ -1,7 +0,0 @@ -#define COMPRESSION_LEVEL 0 -#define STREAMING_MODE 0 -#define QLZ_YVERSION 1_31 - -#include "prolog.h" -#include "1.31/yquicklz.h" -#include "epilog.h" diff --git a/contrib/libs/quicklz/1_31_0_100000.c b/contrib/libs/quicklz/1_31_0_100000.c deleted file mode 100644 index 31657b9d822..00000000000 --- a/contrib/libs/quicklz/1_31_0_100000.c +++ /dev/null @@ -1,4 +0,0 @@ -#define FROM_QUICKLZ_BUILD -#include "1_31_0_100000.h" -#include "1.31/quicklz.c" -#include "table.inc" diff --git a/contrib/libs/quicklz/1_31_0_100000.h b/contrib/libs/quicklz/1_31_0_100000.h deleted file mode 100644 index a879bd831b3..00000000000 --- a/contrib/libs/quicklz/1_31_0_100000.h +++ /dev/null @@ -1,7 +0,0 @@ -#define COMPRESSION_LEVEL 0 -#define STREAMING_MODE 100000 -#define QLZ_YVERSION 1_31 - -#include "prolog.h" -#include "1.31/yquicklz.h" -#include "epilog.h" diff --git a/contrib/libs/quicklz/1_31_0_1000000.c b/contrib/libs/quicklz/1_31_0_1000000.c deleted file mode 100644 index 1893f906b51..00000000000 --- a/contrib/libs/quicklz/1_31_0_1000000.c +++ /dev/null @@ -1,4 +0,0 @@ -#define FROM_QUICKLZ_BUILD -#include "1_31_0_1000000.h" -#include "1.31/quicklz.c" -#include "table.inc" diff --git a/contrib/libs/quicklz/1_31_0_1000000.h b/contrib/libs/quicklz/1_31_0_1000000.h deleted file mode 100644 index a4b608c55aa..00000000000 --- a/contrib/libs/quicklz/1_31_0_1000000.h +++ /dev/null @@ -1,7 +0,0 @@ -#define COMPRESSION_LEVEL 0 -#define STREAMING_MODE 1000000 -#define QLZ_YVERSION 1_31 - -#include "prolog.h" -#include "1.31/yquicklz.h" -#include "epilog.h" diff --git a/contrib/libs/quicklz/1_31_1_0.c b/contrib/libs/quicklz/1_31_1_0.c deleted file mode 100644 index e58bd128838..00000000000 --- a/contrib/libs/quicklz/1_31_1_0.c +++ /dev/null @@ -1,4 +0,0 @@ -#define FROM_QUICKLZ_BUILD -#include "1_31_1_0.h" -#include "1.31/quicklz.c" -#include "table.inc" diff --git a/contrib/libs/quicklz/1_31_1_0.h b/contrib/libs/quicklz/1_31_1_0.h deleted file mode 100644 index c9cf9d3da8f..00000000000 --- a/contrib/libs/quicklz/1_31_1_0.h +++ /dev/null @@ -1,7 +0,0 @@ -#define COMPRESSION_LEVEL 1 -#define STREAMING_MODE 0 -#define QLZ_YVERSION 1_31 - -#include "prolog.h" -#include "1.31/yquicklz.h" -#include "epilog.h" diff --git a/contrib/libs/quicklz/1_31_1_100000.c b/contrib/libs/quicklz/1_31_1_100000.c deleted file mode 100644 index 8850fd4efac..00000000000 --- a/contrib/libs/quicklz/1_31_1_100000.c +++ /dev/null @@ -1,4 +0,0 @@ -#define FROM_QUICKLZ_BUILD -#include "1_31_1_100000.h" -#include "1.31/quicklz.c" -#include "table.inc" diff --git a/contrib/libs/quicklz/1_31_1_100000.h b/contrib/libs/quicklz/1_31_1_100000.h deleted file mode 100644 index a21fa35cb28..00000000000 --- a/contrib/libs/quicklz/1_31_1_100000.h +++ /dev/null @@ -1,7 +0,0 @@ -#define COMPRESSION_LEVEL 1 -#define STREAMING_MODE 100000 -#define QLZ_YVERSION 1_31 - -#include "prolog.h" -#include "1.31/yquicklz.h" -#include "epilog.h" diff --git a/contrib/libs/quicklz/1_31_1_1000000.c b/contrib/libs/quicklz/1_31_1_1000000.c deleted file mode 100644 index 195261b4146..00000000000 --- a/contrib/libs/quicklz/1_31_1_1000000.c +++ /dev/null @@ -1,4 +0,0 @@ -#define FROM_QUICKLZ_BUILD -#include "1_31_1_1000000.h" -#include "1.31/quicklz.c" -#include "table.inc" diff --git a/contrib/libs/quicklz/1_31_1_1000000.h b/contrib/libs/quicklz/1_31_1_1000000.h deleted file mode 100644 index 58a8a279f51..00000000000 --- a/contrib/libs/quicklz/1_31_1_1000000.h +++ /dev/null @@ -1,7 +0,0 @@ -#define COMPRESSION_LEVEL 1 -#define STREAMING_MODE 1000000 -#define QLZ_YVERSION 1_31 - -#include "prolog.h" -#include "1.31/yquicklz.h" -#include "epilog.h" diff --git a/contrib/libs/quicklz/1_31_2_0.c b/contrib/libs/quicklz/1_31_2_0.c deleted file mode 100644 index e4427771198..00000000000 --- a/contrib/libs/quicklz/1_31_2_0.c +++ /dev/null @@ -1,4 +0,0 @@ -#define FROM_QUICKLZ_BUILD -#include "1_31_2_0.h" -#include "1.31/quicklz.c" -#include "table.inc" diff --git a/contrib/libs/quicklz/1_31_2_0.h b/contrib/libs/quicklz/1_31_2_0.h deleted file mode 100644 index 317629ca472..00000000000 --- a/contrib/libs/quicklz/1_31_2_0.h +++ /dev/null @@ -1,7 +0,0 @@ -#define COMPRESSION_LEVEL 2 -#define STREAMING_MODE 0 -#define QLZ_YVERSION 1_31 - -#include "prolog.h" -#include "1.31/yquicklz.h" -#include "epilog.h" diff --git a/contrib/libs/quicklz/1_31_2_100000.c b/contrib/libs/quicklz/1_31_2_100000.c deleted file mode 100644 index 168247b8c81..00000000000 --- a/contrib/libs/quicklz/1_31_2_100000.c +++ /dev/null @@ -1,4 +0,0 @@ -#define FROM_QUICKLZ_BUILD -#include "1_31_2_100000.h" -#include "1.31/quicklz.c" -#include "table.inc" diff --git a/contrib/libs/quicklz/1_31_2_100000.h b/contrib/libs/quicklz/1_31_2_100000.h deleted file mode 100644 index 5103f090036..00000000000 --- a/contrib/libs/quicklz/1_31_2_100000.h +++ /dev/null @@ -1,7 +0,0 @@ -#define COMPRESSION_LEVEL 2 -#define STREAMING_MODE 100000 -#define QLZ_YVERSION 1_31 - -#include "prolog.h" -#include "1.31/yquicklz.h" -#include "epilog.h" diff --git a/contrib/libs/quicklz/1_31_2_1000000.c b/contrib/libs/quicklz/1_31_2_1000000.c deleted file mode 100644 index ebdf0cc27ee..00000000000 --- a/contrib/libs/quicklz/1_31_2_1000000.c +++ /dev/null @@ -1,4 +0,0 @@ -#define FROM_QUICKLZ_BUILD -#include "1_31_2_1000000.h" -#include "1.31/quicklz.c" -#include "table.inc" diff --git a/contrib/libs/quicklz/1_31_2_1000000.h b/contrib/libs/quicklz/1_31_2_1000000.h deleted file mode 100644 index 78bcd419221..00000000000 --- a/contrib/libs/quicklz/1_31_2_1000000.h +++ /dev/null @@ -1,7 +0,0 @@ -#define COMPRESSION_LEVEL 2 -#define STREAMING_MODE 1000000 -#define QLZ_YVERSION 1_31 - -#include "prolog.h" -#include "1.31/yquicklz.h" -#include "epilog.h" diff --git a/contrib/libs/quicklz/1_31_3_0.c b/contrib/libs/quicklz/1_31_3_0.c deleted file mode 100644 index 44df373ec45..00000000000 --- a/contrib/libs/quicklz/1_31_3_0.c +++ /dev/null @@ -1,4 +0,0 @@ -#define FROM_QUICKLZ_BUILD -#include "1_31_3_0.h" -#include "1.31/quicklz.c" -#include "table.inc" diff --git a/contrib/libs/quicklz/1_31_3_0.h b/contrib/libs/quicklz/1_31_3_0.h deleted file mode 100644 index 9f0dedaf672..00000000000 --- a/contrib/libs/quicklz/1_31_3_0.h +++ /dev/null @@ -1,7 +0,0 @@ -#define COMPRESSION_LEVEL 3 -#define STREAMING_MODE 0 -#define QLZ_YVERSION 1_31 - -#include "prolog.h" -#include "1.31/yquicklz.h" -#include "epilog.h" diff --git a/contrib/libs/quicklz/1_31_3_100000.c b/contrib/libs/quicklz/1_31_3_100000.c deleted file mode 100644 index 6552495e1e2..00000000000 --- a/contrib/libs/quicklz/1_31_3_100000.c +++ /dev/null @@ -1,4 +0,0 @@ -#define FROM_QUICKLZ_BUILD -#include "1_31_3_100000.h" -#include "1.31/quicklz.c" -#include "table.inc" diff --git a/contrib/libs/quicklz/1_31_3_100000.h b/contrib/libs/quicklz/1_31_3_100000.h deleted file mode 100644 index 9ed5aa60ddf..00000000000 --- a/contrib/libs/quicklz/1_31_3_100000.h +++ /dev/null @@ -1,7 +0,0 @@ -#define COMPRESSION_LEVEL 3 -#define STREAMING_MODE 100000 -#define QLZ_YVERSION 1_31 - -#include "prolog.h" -#include "1.31/yquicklz.h" -#include "epilog.h" diff --git a/contrib/libs/quicklz/1_31_3_1000000.c b/contrib/libs/quicklz/1_31_3_1000000.c deleted file mode 100644 index 2fd46f47280..00000000000 --- a/contrib/libs/quicklz/1_31_3_1000000.c +++ /dev/null @@ -1,4 +0,0 @@ -#define FROM_QUICKLZ_BUILD -#include "1_31_3_1000000.h" -#include "1.31/quicklz.c" -#include "table.inc" diff --git a/contrib/libs/quicklz/1_31_3_1000000.h b/contrib/libs/quicklz/1_31_3_1000000.h deleted file mode 100644 index 6366f3c5579..00000000000 --- a/contrib/libs/quicklz/1_31_3_1000000.h +++ /dev/null @@ -1,7 +0,0 @@ -#define COMPRESSION_LEVEL 3 -#define STREAMING_MODE 1000000 -#define QLZ_YVERSION 1_31 - -#include "prolog.h" -#include "1.31/yquicklz.h" -#include "epilog.h" diff --git a/contrib/libs/quicklz/1_40_1_0.c b/contrib/libs/quicklz/1_40_1_0.c deleted file mode 100644 index 6ca2a7dff58..00000000000 --- a/contrib/libs/quicklz/1_40_1_0.c +++ /dev/null @@ -1,4 +0,0 @@ -#define FROM_QUICKLZ_BUILD -#include "1_40_1_0.h" -#include "1.40/quicklz.c" -#include "table.inc" diff --git a/contrib/libs/quicklz/1_40_1_0.h b/contrib/libs/quicklz/1_40_1_0.h deleted file mode 100644 index 925da720795..00000000000 --- a/contrib/libs/quicklz/1_40_1_0.h +++ /dev/null @@ -1,7 +0,0 @@ -#define COMPRESSION_LEVEL 1 -#define STREAMING_MODE 0 -#define QLZ_YVERSION 1_40 - -#include "prolog.h" -#include "1.40/yquicklz.h" -#include "epilog.h" diff --git a/contrib/libs/quicklz/1_40_1_100000.c b/contrib/libs/quicklz/1_40_1_100000.c deleted file mode 100644 index 1de256a5e60..00000000000 --- a/contrib/libs/quicklz/1_40_1_100000.c +++ /dev/null @@ -1,4 +0,0 @@ -#define FROM_QUICKLZ_BUILD -#include "1_40_1_100000.h" -#include "1.40/quicklz.c" -#include "table.inc" diff --git a/contrib/libs/quicklz/1_40_1_100000.h b/contrib/libs/quicklz/1_40_1_100000.h deleted file mode 100644 index bb4828855fe..00000000000 --- a/contrib/libs/quicklz/1_40_1_100000.h +++ /dev/null @@ -1,7 +0,0 @@ -#define COMPRESSION_LEVEL 1 -#define STREAMING_MODE 100000 -#define QLZ_YVERSION 1_40 - -#include "prolog.h" -#include "1.40/yquicklz.h" -#include "epilog.h" diff --git a/contrib/libs/quicklz/1_40_1_1000000.c b/contrib/libs/quicklz/1_40_1_1000000.c deleted file mode 100644 index e65f94b3d57..00000000000 --- a/contrib/libs/quicklz/1_40_1_1000000.c +++ /dev/null @@ -1,4 +0,0 @@ -#define FROM_QUICKLZ_BUILD -#include "1_40_1_1000000.h" -#include "1.40/quicklz.c" -#include "table.inc" diff --git a/contrib/libs/quicklz/1_40_1_1000000.h b/contrib/libs/quicklz/1_40_1_1000000.h deleted file mode 100644 index e8de3de93d6..00000000000 --- a/contrib/libs/quicklz/1_40_1_1000000.h +++ /dev/null @@ -1,7 +0,0 @@ -#define COMPRESSION_LEVEL 1 -#define STREAMING_MODE 1000000 -#define QLZ_YVERSION 1_40 - -#include "prolog.h" -#include "1.40/yquicklz.h" -#include "epilog.h" diff --git a/contrib/libs/quicklz/1_40_2_0.c b/contrib/libs/quicklz/1_40_2_0.c deleted file mode 100644 index aadfe9ebb01..00000000000 --- a/contrib/libs/quicklz/1_40_2_0.c +++ /dev/null @@ -1,4 +0,0 @@ -#define FROM_QUICKLZ_BUILD -#include "1_40_2_0.h" -#include "1.40/quicklz.c" -#include "table.inc" diff --git a/contrib/libs/quicklz/1_40_2_0.h b/contrib/libs/quicklz/1_40_2_0.h deleted file mode 100644 index 497c1951e80..00000000000 --- a/contrib/libs/quicklz/1_40_2_0.h +++ /dev/null @@ -1,7 +0,0 @@ -#define COMPRESSION_LEVEL 2 -#define STREAMING_MODE 0 -#define QLZ_YVERSION 1_40 - -#include "prolog.h" -#include "1.40/yquicklz.h" -#include "epilog.h" diff --git a/contrib/libs/quicklz/1_40_2_100000.c b/contrib/libs/quicklz/1_40_2_100000.c deleted file mode 100644 index 44afe8054f2..00000000000 --- a/contrib/libs/quicklz/1_40_2_100000.c +++ /dev/null @@ -1,4 +0,0 @@ -#define FROM_QUICKLZ_BUILD -#include "1_40_2_100000.h" -#include "1.40/quicklz.c" -#include "table.inc" diff --git a/contrib/libs/quicklz/1_40_2_100000.h b/contrib/libs/quicklz/1_40_2_100000.h deleted file mode 100644 index dd4e391fd7f..00000000000 --- a/contrib/libs/quicklz/1_40_2_100000.h +++ /dev/null @@ -1,7 +0,0 @@ -#define COMPRESSION_LEVEL 2 -#define STREAMING_MODE 100000 -#define QLZ_YVERSION 1_40 - -#include "prolog.h" -#include "1.40/yquicklz.h" -#include "epilog.h" diff --git a/contrib/libs/quicklz/1_40_2_1000000.c b/contrib/libs/quicklz/1_40_2_1000000.c deleted file mode 100644 index 601e295d5c4..00000000000 --- a/contrib/libs/quicklz/1_40_2_1000000.c +++ /dev/null @@ -1,4 +0,0 @@ -#define FROM_QUICKLZ_BUILD -#include "1_40_2_1000000.h" -#include "1.40/quicklz.c" -#include "table.inc" diff --git a/contrib/libs/quicklz/1_40_2_1000000.h b/contrib/libs/quicklz/1_40_2_1000000.h deleted file mode 100644 index 5e5f578e222..00000000000 --- a/contrib/libs/quicklz/1_40_2_1000000.h +++ /dev/null @@ -1,7 +0,0 @@ -#define COMPRESSION_LEVEL 2 -#define STREAMING_MODE 1000000 -#define QLZ_YVERSION 1_40 - -#include "prolog.h" -#include "1.40/yquicklz.h" -#include "epilog.h" diff --git a/contrib/libs/quicklz/1_40_3_0.c b/contrib/libs/quicklz/1_40_3_0.c deleted file mode 100644 index 43532ac429b..00000000000 --- a/contrib/libs/quicklz/1_40_3_0.c +++ /dev/null @@ -1,4 +0,0 @@ -#define FROM_QUICKLZ_BUILD -#include "1_40_3_0.h" -#include "1.40/quicklz.c" -#include "table.inc" diff --git a/contrib/libs/quicklz/1_40_3_0.h b/contrib/libs/quicklz/1_40_3_0.h deleted file mode 100644 index 4fba431829f..00000000000 --- a/contrib/libs/quicklz/1_40_3_0.h +++ /dev/null @@ -1,7 +0,0 @@ -#define COMPRESSION_LEVEL 3 -#define STREAMING_MODE 0 -#define QLZ_YVERSION 1_40 - -#include "prolog.h" -#include "1.40/yquicklz.h" -#include "epilog.h" diff --git a/contrib/libs/quicklz/1_40_3_100000.c b/contrib/libs/quicklz/1_40_3_100000.c deleted file mode 100644 index cb07b2bd487..00000000000 --- a/contrib/libs/quicklz/1_40_3_100000.c +++ /dev/null @@ -1,4 +0,0 @@ -#define FROM_QUICKLZ_BUILD -#include "1_40_3_100000.h" -#include "1.40/quicklz.c" -#include "table.inc" diff --git a/contrib/libs/quicklz/1_40_3_100000.h b/contrib/libs/quicklz/1_40_3_100000.h deleted file mode 100644 index 3f89c94f32b..00000000000 --- a/contrib/libs/quicklz/1_40_3_100000.h +++ /dev/null @@ -1,7 +0,0 @@ -#define COMPRESSION_LEVEL 3 -#define STREAMING_MODE 100000 -#define QLZ_YVERSION 1_40 - -#include "prolog.h" -#include "1.40/yquicklz.h" -#include "epilog.h" diff --git a/contrib/libs/quicklz/1_40_3_1000000.c b/contrib/libs/quicklz/1_40_3_1000000.c deleted file mode 100644 index c544d6a308c..00000000000 --- a/contrib/libs/quicklz/1_40_3_1000000.c +++ /dev/null @@ -1,4 +0,0 @@ -#define FROM_QUICKLZ_BUILD -#include "1_40_3_1000000.h" -#include "1.40/quicklz.c" -#include "table.inc" diff --git a/contrib/libs/quicklz/1_40_3_1000000.h b/contrib/libs/quicklz/1_40_3_1000000.h deleted file mode 100644 index d750a51b5a1..00000000000 --- a/contrib/libs/quicklz/1_40_3_1000000.h +++ /dev/null @@ -1,7 +0,0 @@ -#define COMPRESSION_LEVEL 3 -#define STREAMING_MODE 1000000 -#define QLZ_YVERSION 1_40 - -#include "prolog.h" -#include "1.40/yquicklz.h" -#include "epilog.h" diff --git a/contrib/libs/quicklz/all.c b/contrib/libs/quicklz/all.c deleted file mode 100644 index cf6c3688ba7..00000000000 --- a/contrib/libs/quicklz/all.c +++ /dev/null @@ -1,21 +0,0 @@ -#include "1_31_0_0.c" -#include "1_31_0_100000.c" -#include "1_31_0_1000000.c" -#include "1_31_1_0.c" -#include "1_31_1_100000.c" -#include "1_31_1_1000000.c" -#include "1_31_2_0.c" -#include "1_31_2_100000.c" -#include "1_31_2_1000000.c" -#include "1_31_3_0.c" -#include "1_31_3_100000.c" -#include "1_31_3_1000000.c" -#include "1_40_1_0.c" -#include "1_40_1_100000.c" -#include "1_40_1_1000000.c" -#include "1_40_2_0.c" -#include "1_40_2_100000.c" -#include "1_40_2_1000000.c" -#include "1_40_3_0.c" -#include "1_40_3_100000.c" -#include "1_40_3_1000000.c" diff --git a/contrib/libs/quicklz/epilog.h b/contrib/libs/quicklz/epilog.h deleted file mode 100644 index 78b6c37b3d1..00000000000 --- a/contrib/libs/quicklz/epilog.h +++ /dev/null @@ -1,32 +0,0 @@ -#if !defined(FROM_QUICKLZ_BUILD) - #undef qlz_decompress - #undef qlz_compress - #undef qlz_size_decompressed - #undef qlz_size_compressed - #undef qlz_get_setting - #undef qlz_table - #undef qlz_compress_core - #undef qlz_decompress_core - #undef hash_func - #undef fast_read - #undef fast_write - #undef reset_state - #undef memcpy_up - #undef update_hash - #undef fast_read_safe - #undef same - #undef reset_table_compress - #undef reset_table_decompress - #undef hashat - #undef qlz_size_header - #undef qlz_state_compress - #undef qlz_state_decompress - #undef qlz_hash_compress - #undef qlz_hash_decompress - - #undef COMPRESSION_LEVEL - #undef STREAMING_MODE - #undef QLZ_YVERSION - #undef QLZ_COMPRESSION_LEVEL - #undef QLZ_STREAMING_BUFFER -#endif diff --git a/contrib/libs/quicklz/prolog.h b/contrib/libs/quicklz/prolog.h deleted file mode 100644 index aea8270e967..00000000000 --- a/contrib/libs/quicklz/prolog.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef prolog_h_as78d5f67sdf -#define prolog_h_as78d5f67sdf - -#include "table.h" - -#define RENAME(a) DO_RENAME(QLZ_YVERSION, COMPRESSION_LEVEL, STREAMING_MODE, a) -#define DO_RENAME(a, b, c, d) DO_RENAME2(a, b, c, d) -#define DO_RENAME2(a, b, c, d) yqlz_ ## a ## _ ## b ## _ ## c ## _ ## d - -#endif - -#define qlz_decompress RENAME(decompress) -#define qlz_compress RENAME(compress) -#define qlz_size_decompressed RENAME(size_decompressed) -#define qlz_size_compressed RENAME(size_compressed) -#define qlz_get_setting RENAME(get_setting) -#define qlz_table RENAME(table) -#define qlz_compress_core RENAME(compress_core) -#define qlz_decompress_core RENAME(decompress_core) -#define hash_func RENAME(hash_func) -#define fast_read RENAME(fast_read) -#define fast_write RENAME(fast_write) -#define reset_state RENAME(reset_state) -#define memcpy_up RENAME(memcpy_up) -#define update_hash RENAME(update_hash) -#define fast_read_safe RENAME(fast_read_safe) -#define update_hash_upto RENAME(update_hash_upto) -#define same RENAME(same) -#define reset_table_compress RENAME(reset_table_compress) -#define reset_table_decompress RENAME(reset_table_decompress) -#define hashat RENAME(hashat) -#define qlz_size_header RENAME(qlz_size_header) -#define qlz_state_compress RENAME(qlz_state_compress) -#define qlz_state_decompress RENAME(qlz_state_decompress) -#define qlz_hash_compress RENAME(qlz_hash_compress) -#define qlz_hash_decompress RENAME(qlz_hash_decompress) diff --git a/contrib/libs/quicklz/quicklz.cpp b/contrib/libs/quicklz/quicklz.cpp deleted file mode 100644 index 044ce45d548..00000000000 --- a/contrib/libs/quicklz/quicklz.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include "quicklz.h" - -extern "C" struct TQuickLZMethods* GetLzq151Table(unsigned level, unsigned buf); - -const TQuickLZMethods* LzqTable(unsigned ver, unsigned level, unsigned buf) { - if (ver > 2 || level > 3 || buf > 2) { - return 0; - } - - if (ver == 2) { - if (!level) { - return 0; - } - - return GetLzq151Table(level - 1, buf); - } - - return GetLzqTable(ver, level, buf); -} diff --git a/contrib/libs/quicklz/quicklz.h b/contrib/libs/quicklz/quicklz.h deleted file mode 100644 index f6f542abfcd..00000000000 --- a/contrib/libs/quicklz/quicklz.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef quicklz_h_sad8fs78d5f -#define quicklz_h_sad8fs78d5f - -#include "table.h" -#include "quicklz.inc" -#define FROM_QUICKLZ_BUILD -#include "1_31_0_0.h" -#undef FROM_QUICKLZ_BUILD -#include "table.h" - -#if defined(__cplusplus) -const TQuickLZMethods* LzqTable(unsigned ver, unsigned level, unsigned buf); -#endif - -#endif diff --git a/contrib/libs/quicklz/quicklz.inc b/contrib/libs/quicklz/quicklz.inc deleted file mode 100644 index d54e18b32e4..00000000000 --- a/contrib/libs/quicklz/quicklz.inc +++ /dev/null @@ -1,21 +0,0 @@ -#include "1_31_0_0.h" -#include "1_31_0_100000.h" -#include "1_31_0_1000000.h" -#include "1_31_1_0.h" -#include "1_31_1_100000.h" -#include "1_31_1_1000000.h" -#include "1_31_2_0.h" -#include "1_31_2_100000.h" -#include "1_31_2_1000000.h" -#include "1_31_3_0.h" -#include "1_31_3_100000.h" -#include "1_31_3_1000000.h" -#include "1_40_1_0.h" -#include "1_40_1_100000.h" -#include "1_40_1_1000000.h" -#include "1_40_2_0.h" -#include "1_40_2_100000.h" -#include "1_40_2_1000000.h" -#include "1_40_3_0.h" -#include "1_40_3_100000.h" -#include "1_40_3_1000000.h" diff --git a/contrib/libs/quicklz/table.c b/contrib/libs/quicklz/table.c deleted file mode 100644 index 782a484c159..00000000000 --- a/contrib/libs/quicklz/table.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "table.h" -#include "tables2.inc" - -static struct TQuickLZMethods* qlz_tables[2][4][3] = - #include "tables1.inc" -; - -struct TQuickLZMethods* GetLzqTable(unsigned ver, unsigned level, unsigned buf) { - return qlz_tables[ver][level][buf]; -} diff --git a/contrib/libs/quicklz/table.h b/contrib/libs/quicklz/table.h deleted file mode 100644 index cac42fe6f08..00000000000 --- a/contrib/libs/quicklz/table.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef table_h_asd78567asdf -#define table_h_asd78567asdf - -#include <string.h> - -#if defined(__cplusplus) -extern "C" { -#endif - -struct TQuickLZMethods { - size_t (*SizeDecompressed)(const char* source); - size_t (*SizeCompressed)(const char* source); - size_t (*Decompress)(const char* source, void* destination, char* scratch_decompress); - size_t (*Compress)(const void* source, char* destination, size_t size, char* scratch_compress); - int (*Setting)(int setting); - - const char* Name; -}; - -struct TQuickLZMethods* GetLzqTable(unsigned ver, unsigned level, unsigned buf); - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/contrib/libs/quicklz/table.inc b/contrib/libs/quicklz/table.inc deleted file mode 100644 index ede67197a67..00000000000 --- a/contrib/libs/quicklz/table.inc +++ /dev/null @@ -1,51 +0,0 @@ -#include "table.h" - -#define STR(a) STR2(a) -#define STR2(a) STR3(a) -#define STR3(a) #a - -struct TQuickLZMethods qlz_table = { - qlz_size_decompressed, - qlz_size_compressed, - qlz_decompress, - qlz_compress, - qlz_get_setting, - STR(QLZ_YVERSION) "-" STR(COMPRESSION_LEVEL) "-" STR(STREAMING_MODE) -}; - -#undef STR -#undef STR2 -#undef STR3 -#undef QLZ_VERSION_MAJOR -#undef QLZ_VERSION_MINOR -#undef QLZ_VERSION_REVISION -#undef test_rle -#undef speedup_incompressible -#undef __inline -#undef X86X64 -#undef HASH_ENTRIES -#undef AND -#undef HASH_SIZE -#undef STREAMING_MODE_VALUE -#undef STREAMING_MODE_ROUNDED -#undef SCRATCH_COMPRESS -#undef SCRATCH_DECOMPRESS -#undef X86X64 -#undef MINOFFSET -#undef UNCONDITIONAL_MATCHLEN -#undef UNCOMPRESSED_END -#undef CWORD_LEN -#undef QLZ_HEADER -#undef QLZ_VERSION_MAJOR -#undef QLZ_VERSION_MINOR -#undef QLZ_VERSION_REVISION -#undef QLZ_POINTERS -#undef QLZ_HASH_VALUES -#undef QLZ_POINTERS -#undef QLZ_HASH_VALUES -#undef QLZ_POINTERS -#undef QLZ_HASH_VALUES -#undef QLZ_ALIGNMENT_PADD -#undef QLZ_BUFFER_COUNTER -#undef QLZ_SCRATCH_COMPRESS -#undef QLZ_SCRATCH_DECOMPRESS diff --git a/contrib/libs/quicklz/tables1.inc b/contrib/libs/quicklz/tables1.inc deleted file mode 100644 index fdfb28dfb1d..00000000000 --- a/contrib/libs/quicklz/tables1.inc +++ /dev/null @@ -1 +0,0 @@ -{{{&yqlz_1_31_0_0_table,&yqlz_1_31_0_100000_table,&yqlz_1_31_0_1000000_table},{&yqlz_1_31_1_0_table,&yqlz_1_31_1_100000_table,&yqlz_1_31_1_1000000_table},{&yqlz_1_31_2_0_table,&yqlz_1_31_2_100000_table,&yqlz_1_31_2_1000000_table},{&yqlz_1_31_3_0_table,&yqlz_1_31_3_100000_table,&yqlz_1_31_3_1000000_table}},{{0,0,0},{&yqlz_1_40_1_0_table,&yqlz_1_40_1_100000_table,&yqlz_1_40_1_1000000_table},{&yqlz_1_40_2_0_table,&yqlz_1_40_2_100000_table,&yqlz_1_40_2_1000000_table},{&yqlz_1_40_3_0_table,&yqlz_1_40_3_100000_table,&yqlz_1_40_3_1000000_table}}} diff --git a/contrib/libs/quicklz/tables2.inc b/contrib/libs/quicklz/tables2.inc deleted file mode 100644 index 81a921ab1af..00000000000 --- a/contrib/libs/quicklz/tables2.inc +++ /dev/null @@ -1,21 +0,0 @@ -extern struct TQuickLZMethods yqlz_1_31_0_0_table; -extern struct TQuickLZMethods yqlz_1_31_0_100000_table; -extern struct TQuickLZMethods yqlz_1_31_0_1000000_table; -extern struct TQuickLZMethods yqlz_1_31_1_0_table; -extern struct TQuickLZMethods yqlz_1_31_1_100000_table; -extern struct TQuickLZMethods yqlz_1_31_1_1000000_table; -extern struct TQuickLZMethods yqlz_1_31_2_0_table; -extern struct TQuickLZMethods yqlz_1_31_2_100000_table; -extern struct TQuickLZMethods yqlz_1_31_2_1000000_table; -extern struct TQuickLZMethods yqlz_1_31_3_0_table; -extern struct TQuickLZMethods yqlz_1_31_3_100000_table; -extern struct TQuickLZMethods yqlz_1_31_3_1000000_table; -extern struct TQuickLZMethods yqlz_1_40_1_0_table; -extern struct TQuickLZMethods yqlz_1_40_1_100000_table; -extern struct TQuickLZMethods yqlz_1_40_1_1000000_table; -extern struct TQuickLZMethods yqlz_1_40_2_0_table; -extern struct TQuickLZMethods yqlz_1_40_2_100000_table; -extern struct TQuickLZMethods yqlz_1_40_2_1000000_table; -extern struct TQuickLZMethods yqlz_1_40_3_0_table; -extern struct TQuickLZMethods yqlz_1_40_3_100000_table; -extern struct TQuickLZMethods yqlz_1_40_3_1000000_table; |