liblzma: Move lzma_crcXX_table[][] declarations to crc_common.h

LZ encoder needs lzma_crc32_table[0] but otherwise those tables
are private to the CRC code. In contrast, the other things in
check.h are needed in several places.
This commit is contained in:
Lasse Collin 2024-06-23 14:22:08 +03:00
parent 85b081f5d4
commit 7484d37538
4 changed files with 23 additions and 20 deletions

View File

@ -95,24 +95,6 @@ typedef struct {
} lzma_check_state;
/// lzma_crc32_table[0] is needed by LZ encoder so we need to keep
/// the array two-dimensional.
#ifdef HAVE_SMALL
lzma_attr_visibility_hidden
extern uint32_t lzma_crc32_table[1][256];
extern void lzma_crc32_init(void);
#else
lzma_attr_visibility_hidden
extern const uint32_t lzma_crc32_table[8][256];
lzma_attr_visibility_hidden
extern const uint64_t lzma_crc64_table[4][256];
#endif
/// \brief Initialize *check depending on type
extern void lzma_check_init(lzma_check_state *check, lzma_check type);

View File

@ -10,8 +10,11 @@
///////////////////////////////////////////////////////////////////////////////
#include "check.h"
#include "crc_common.h"
// The table is used by the LZ encoder too, thus it's not static like
// in crc64_small.c.
uint32_t lzma_crc32_table[1][256];

View File

@ -38,6 +38,24 @@
#endif
/// lzma_crc32_table[0] is needed by LZ encoder so we need to keep
/// the array two-dimensional.
#ifdef HAVE_SMALL
lzma_attr_visibility_hidden
extern uint32_t lzma_crc32_table[1][256];
extern void lzma_crc32_init(void);
#else
lzma_attr_visibility_hidden
extern const uint32_t lzma_crc32_table[8][256];
lzma_attr_visibility_hidden
extern const uint64_t lzma_crc64_table[4][256];
#endif
// Keep this in sync with changes to crc32_arm64.h
#if defined(_WIN32) || defined(HAVE_GETAUXVAL) \
|| defined(HAVE_ELF_AUX_INFO) \

View File

@ -13,7 +13,8 @@
#ifndef LZMA_LZ_ENCODER_HASH_H
#define LZMA_LZ_ENCODER_HASH_H
// We need to know if CRC32_GENERIC is defined.
// We need to know if CRC32_GENERIC is defined and we may need the declaration
// of lzma_crc32_table[][].
#include "crc_common.h"
// If HAVE_SMALL is defined, then lzma_crc32_table[][] exists and
@ -28,7 +29,6 @@
// then lzma_crc32_table[][] doesn't exist.
#if defined(HAVE_SMALL) \
|| (defined(CRC32_GENERIC) && !defined(WORDS_BIGENDIAN))
# include "check.h"
# define hash_table lzma_crc32_table[0]
#else
// lz_encoder.c takes care of including the actual table.