From 244866c48ee28f7fdbfab69b29431af4ecec944d Mon Sep 17 00:00:00 2001 From: pelya Date: Wed, 12 Nov 2014 00:15:03 +0200 Subject: [PATCH] Fixed LZMA compilation --- .../jni/lzma/src/liblzma/check/crc32_small.c | 61 --------- .../lzma/src/liblzma/check/crc32_tablegen.c | 117 ------------------ .../jni/lzma/src/liblzma/check/crc64_small.c | 53 -------- .../lzma/src/liblzma/check/crc64_tablegen.c | 88 ------------- .../lzma/src/liblzma/lzma/fastpos_tablegen.c | 56 --------- .../src/liblzma/rangecoder/price_tablegen.c | 87 ------------- 6 files changed, 462 deletions(-) delete mode 100644 project/jni/lzma/src/liblzma/check/crc32_small.c delete mode 100644 project/jni/lzma/src/liblzma/check/crc32_tablegen.c delete mode 100644 project/jni/lzma/src/liblzma/check/crc64_small.c delete mode 100644 project/jni/lzma/src/liblzma/check/crc64_tablegen.c delete mode 100644 project/jni/lzma/src/liblzma/lzma/fastpos_tablegen.c delete mode 100644 project/jni/lzma/src/liblzma/rangecoder/price_tablegen.c diff --git a/project/jni/lzma/src/liblzma/check/crc32_small.c b/project/jni/lzma/src/liblzma/check/crc32_small.c deleted file mode 100644 index 5f8a32868..000000000 --- a/project/jni/lzma/src/liblzma/check/crc32_small.c +++ /dev/null @@ -1,61 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file crc32_small.c -/// \brief CRC32 calculation (size-optimized) -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#include "check.h" - - -uint32_t lzma_crc32_table[1][256]; - - -static void -crc32_init(void) -{ - static const uint32_t poly32 = UINT32_C(0xEDB88320); - - for (size_t b = 0; b < 256; ++b) { - uint32_t r = b; - for (size_t i = 0; i < 8; ++i) { - if (r & 1) - r = (r >> 1) ^ poly32; - else - r >>= 1; - } - - lzma_crc32_table[0][b] = r; - } - - return; -} - - -extern void -lzma_crc32_init(void) -{ - mythread_once(crc32_init); - return; -} - - -extern LZMA_API(uint32_t) -lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc) -{ - lzma_crc32_init(); - - crc = ~crc; - - while (size != 0) { - crc = lzma_crc32_table[0][*buf++ ^ (crc & 0xFF)] ^ (crc >> 8); - --size; - } - - return ~crc; -} diff --git a/project/jni/lzma/src/liblzma/check/crc32_tablegen.c b/project/jni/lzma/src/liblzma/check/crc32_tablegen.c deleted file mode 100644 index 31a4d2751..000000000 --- a/project/jni/lzma/src/liblzma/check/crc32_tablegen.c +++ /dev/null @@ -1,117 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file crc32_tablegen.c -/// \brief Generate crc32_table_le.h and crc32_table_be.h -/// -/// Compiling: gcc -std=c99 -o crc32_tablegen crc32_tablegen.c -/// Add -DWORDS_BIGENDIAN to generate big endian table. -/// Add -DLZ_HASH_TABLE to generate lz_encoder_hash_table.h (little endian). -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#include -#include "../../common/tuklib_integer.h" - - -static uint32_t crc32_table[8][256]; - - -static void -init_crc32_table(void) -{ - static const uint32_t poly32 = UINT32_C(0xEDB88320); - - for (size_t s = 0; s < 8; ++s) { - for (size_t b = 0; b < 256; ++b) { - uint32_t r = s == 0 ? b : crc32_table[s - 1][b]; - - for (size_t i = 0; i < 8; ++i) { - if (r & 1) - r = (r >> 1) ^ poly32; - else - r >>= 1; - } - - crc32_table[s][b] = r; - } - } - -#ifdef WORDS_BIGENDIAN - for (size_t s = 0; s < 8; ++s) - for (size_t b = 0; b < 256; ++b) - crc32_table[s][b] = bswap32(crc32_table[s][b]); -#endif - - return; -} - - -static void -print_crc32_table(void) -{ - printf("/* This file has been automatically generated by " - "crc32_tablegen.c. */\n\n" - "const uint32_t lzma_crc32_table[8][256] = {\n\t{"); - - for (size_t s = 0; s < 8; ++s) { - for (size_t b = 0; b < 256; ++b) { - if ((b % 4) == 0) - printf("\n\t\t"); - - printf("0x%08" PRIX32, crc32_table[s][b]); - - if (b != 255) - printf(",%s", (b+1) % 4 == 0 ? "" : " "); - } - - if (s == 7) - printf("\n\t}\n};\n"); - else - printf("\n\t}, {"); - } - - return; -} - - -static void -print_lz_table(void) -{ - printf("/* This file has been automatically generated by " - "crc32_tablegen.c. */\n\n" - "const uint32_t lzma_lz_hash_table[256] = {"); - - for (size_t b = 0; b < 256; ++b) { - if ((b % 4) == 0) - printf("\n\t"); - - printf("0x%08" PRIX32, crc32_table[0][b]); - - if (b != 255) - printf(",%s", (b+1) % 4 == 0 ? "" : " "); - } - - printf("\n};\n"); - - return; -} - - -int -main(void) -{ - init_crc32_table(); - -#ifdef LZ_HASH_TABLE - print_lz_table(); -#else - print_crc32_table(); -#endif - - return 0; -} diff --git a/project/jni/lzma/src/liblzma/check/crc64_small.c b/project/jni/lzma/src/liblzma/check/crc64_small.c deleted file mode 100644 index 55d72316b..000000000 --- a/project/jni/lzma/src/liblzma/check/crc64_small.c +++ /dev/null @@ -1,53 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file crc64_small.c -/// \brief CRC64 calculation (size-optimized) -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#include "check.h" - - -static uint64_t crc64_table[256]; - - -static void -crc64_init(void) -{ - static const uint64_t poly64 = UINT64_C(0xC96C5795D7870F42); - - for (size_t b = 0; b < 256; ++b) { - uint64_t r = b; - for (size_t i = 0; i < 8; ++i) { - if (r & 1) - r = (r >> 1) ^ poly64; - else - r >>= 1; - } - - crc64_table[b] = r; - } - - return; -} - - -extern LZMA_API(uint64_t) -lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc) -{ - mythread_once(crc64_init); - - crc = ~crc; - - while (size != 0) { - crc = crc64_table[*buf++ ^ (crc & 0xFF)] ^ (crc >> 8); - --size; - } - - return ~crc; -} diff --git a/project/jni/lzma/src/liblzma/check/crc64_tablegen.c b/project/jni/lzma/src/liblzma/check/crc64_tablegen.c deleted file mode 100644 index fddaa7ed1..000000000 --- a/project/jni/lzma/src/liblzma/check/crc64_tablegen.c +++ /dev/null @@ -1,88 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file crc64_tablegen.c -/// \brief Generate crc64_table_le.h and crc64_table_be.h -/// -/// Compiling: gcc -std=c99 -o crc64_tablegen crc64_tablegen.c -/// Add -DWORDS_BIGENDIAN to generate big endian table. -// -// Author: Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#include -#include "../../common/tuklib_integer.h" - - -static uint64_t crc64_table[4][256]; - - -extern void -init_crc64_table(void) -{ - static const uint64_t poly64 = UINT64_C(0xC96C5795D7870F42); - - for (size_t s = 0; s < 4; ++s) { - for (size_t b = 0; b < 256; ++b) { - uint64_t r = s == 0 ? b : crc64_table[s - 1][b]; - - for (size_t i = 0; i < 8; ++i) { - if (r & 1) - r = (r >> 1) ^ poly64; - else - r >>= 1; - } - - crc64_table[s][b] = r; - } - } - -#ifdef WORDS_BIGENDIAN - for (size_t s = 0; s < 4; ++s) - for (size_t b = 0; b < 256; ++b) - crc64_table[s][b] = bswap64(crc64_table[s][b]); -#endif - - return; -} - - -static void -print_crc64_table(void) -{ - printf("/* This file has been automatically generated by " - "crc64_tablegen.c. */\n\n" - "const uint64_t lzma_crc64_table[4][256] = {\n\t{"); - - for (size_t s = 0; s < 4; ++s) { - for (size_t b = 0; b < 256; ++b) { - if ((b % 2) == 0) - printf("\n\t\t"); - - printf("UINT64_C(0x%016" PRIX64 ")", - crc64_table[s][b]); - - if (b != 255) - printf(",%s", (b+1) % 2 == 0 ? "" : " "); - } - - if (s == 3) - printf("\n\t}\n};\n"); - else - printf("\n\t}, {"); - } - - return; -} - - -int -main(void) -{ - init_crc64_table(); - print_crc64_table(); - return 0; -} diff --git a/project/jni/lzma/src/liblzma/lzma/fastpos_tablegen.c b/project/jni/lzma/src/liblzma/lzma/fastpos_tablegen.c deleted file mode 100644 index c97e6f411..000000000 --- a/project/jni/lzma/src/liblzma/lzma/fastpos_tablegen.c +++ /dev/null @@ -1,56 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file fastpos_tablegen.c -/// \brief Generates the lzma_fastpos[] lookup table -/// -// Authors: Igor Pavlov -// Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include -#include "fastpos.h" - - -int -main(void) -{ - uint8_t fastpos[1 << FASTPOS_BITS]; - - const uint8_t fast_slots = 2 * FASTPOS_BITS; - uint32_t c = 2; - - fastpos[0] = 0; - fastpos[1] = 1; - - for (uint8_t slot_fast = 2; slot_fast < fast_slots; ++slot_fast) { - const uint32_t k = 1 << ((slot_fast >> 1) - 1); - for (uint32_t j = 0; j < k; ++j, ++c) - fastpos[c] = slot_fast; - } - - printf("/* This file has been automatically generated " - "by fastpos_tablegen.c. */\n\n" - "#include \"common.h\"\n" - "#include \"fastpos.h\"\n\n" - "const uint8_t lzma_fastpos[1 << FASTPOS_BITS] = {"); - - for (size_t i = 0; i < (1 << FASTPOS_BITS); ++i) { - if (i % 16 == 0) - printf("\n\t"); - - printf("%3u", (unsigned int)(fastpos[i])); - - if (i != (1 << FASTPOS_BITS) - 1) - printf(","); - } - - printf("\n};\n"); - - return 0; -} diff --git a/project/jni/lzma/src/liblzma/rangecoder/price_tablegen.c b/project/jni/lzma/src/liblzma/rangecoder/price_tablegen.c deleted file mode 100644 index bf08ce39d..000000000 --- a/project/jni/lzma/src/liblzma/rangecoder/price_tablegen.c +++ /dev/null @@ -1,87 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////// -// -/// \file price_tablegen.c -/// \brief Probability price table generator -/// -/// Compiling: gcc -std=c99 -o price_tablegen price_tablegen.c -/// -// Authors: Igor Pavlov -// Lasse Collin -// -// This file has been put into the public domain. -// You can do whatever you want with this file. -// -/////////////////////////////////////////////////////////////////////////////// - -#include -#include -#include "range_common.h" -#include "price.h" - - -static uint32_t rc_prices[RC_PRICE_TABLE_SIZE]; - - -static void -init_price_table(void) -{ - for (uint32_t i = (UINT32_C(1) << RC_MOVE_REDUCING_BITS) / 2; - i < RC_BIT_MODEL_TOTAL; - i += (UINT32_C(1) << RC_MOVE_REDUCING_BITS)) { - const uint32_t cycles_bits = RC_BIT_PRICE_SHIFT_BITS; - uint32_t w = i; - uint32_t bit_count = 0; - - for (uint32_t j = 0; j < cycles_bits; ++j) { - w *= w; - bit_count <<= 1; - - while (w >= (UINT32_C(1) << 16)) { - w >>= 1; - ++bit_count; - } - } - - rc_prices[i >> RC_MOVE_REDUCING_BITS] - = (RC_BIT_MODEL_TOTAL_BITS << cycles_bits) - - 15 - bit_count; - } - - return; -} - - -static void -print_price_table(void) -{ - printf("/* This file has been automatically generated by " - "price_tablegen.c. */\n\n" - "#include \"range_encoder.h\"\n\n" - "const uint8_t lzma_rc_prices[" - "RC_PRICE_TABLE_SIZE] = {"); - - const size_t array_size = sizeof(lzma_rc_prices) - / sizeof(lzma_rc_prices[0]); - for (size_t i = 0; i < array_size; ++i) { - if (i % 8 == 0) - printf("\n\t"); - - printf("%4" PRIu32, rc_prices[i]); - - if (i != array_size - 1) - printf(","); - } - - printf("\n};\n"); - - return; -} - - -int -main(void) -{ - init_price_table(); - print_price_table(); - return 0; -}