summaryrefslogtreecommitdiff
path: root/crc32.c
diff options
context:
space:
mode:
authorMika T. Lindqvist <postmaster@raasu.org>2019-05-20 11:41:09 +0300
committerHans Kristian Rosbach <hk-github@circlestorm.org>2019-05-29 11:46:35 +0200
commite12905a0c2e7cad4d35d7ac7cb71978186436df4 (patch)
tree3946f9f3ef1c13e2c0c131f5711b3aac45c86c21 /crc32.c
parent8e30d1173699412c11880db10de2bc10893a2448 (diff)
Fix build when DYNAMIC_CRC_TABLE is defined.
Diffstat (limited to 'crc32.c')
-rw-r--r--crc32.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/crc32.c b/crc32.c
index ddc2e12..6c495a5 100644
--- a/crc32.c
+++ b/crc32.c
@@ -13,6 +13,7 @@
# include "zbuild.h"
# include "gzendian.h"
+# include <inttypes.h>
/*
Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore
@@ -56,10 +57,10 @@ static uint32_t gf2_matrix_times(const uint32_t *mat, uint32_t vec) {
}
#ifdef DYNAMIC_CRC_TABLE
-static volatile int crc_table_empty = 1;
+volatile int crc_table_empty = 1;
static uint32_t crc_table[8][256];
static uint32_t crc_comb[GF2_DIM][GF2_DIM];
-static void make_crc_table(void);
+void make_crc_table(void);
static void gf2_matrix_square(uint32_t *square, const uint32_t *mat);
#ifdef MAKECRCH
static void write_table(FILE *, const uint32_t *, int);
@@ -99,7 +100,7 @@ static void gf2_matrix_square(uint32_t *square, const uint32_t *mat) {
allow for word-at-a-time CRC calculation for both big-endian and little-
endian machines, where a word is four bytes.
*/
-static void make_crc_table() {
+void make_crc_table() {
uint32_t c;
int n, k;
uint32_t poly; /* polynomial exclusive-or pattern */
@@ -209,7 +210,7 @@ static void write_table(FILE *out, const uint32_t *table, int k) {
int n;
for (n = 0; n < k; n++)
- fprintf(out, "%s0x%08lx%s", n % 5 ? "" : " ",
+ fprintf(out, "%s0x%08" PRIx32 "%s", n % 5 ? "" : " ",
(uint32_t)(table[n]),
n == k - 1 ? "\n" : (n % 5 == 4 ? ",\n" : ", "));
}