]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Kill BYFOUR --- there's no reason to disabled it (NOBYFOUR)
authorDaniel Axtens <dja@axtens.net>
Sat, 9 May 2015 05:58:59 +0000 (15:58 +1000)
committerHans Kristian Rosbach <hk-git@circlestorm.org>
Mon, 11 May 2015 09:45:27 +0000 (11:45 +0200)
Signed-off-by: Daniel Axtens <dja@axtens.net>
crc32.c
crc32.h

diff --git a/crc32.c b/crc32.c
index 595a4a69ce589439e4695f7adf1c79643e8f60ec..b365f509bbf18c196d4e2b8a4f3ccd4a30c1e355 100644 (file)
--- a/crc32.c
+++ b/crc32.c
 
 #define local static
 
-/* Definitions for doing the crc four data bytes at a time. */
-#if !defined(NOBYFOUR) && defined(Z_U4)
-#  define BYFOUR
-#endif
-#ifdef BYFOUR
-   local unsigned long crc32_little (unsigned long, const unsigned char *, unsigned);
-   local unsigned long crc32_big (unsigned long, const unsigned char *, unsigned);
-#  define TBLS 8
-#else
-#  define TBLS 1
-#endif /* BYFOUR */
+local unsigned long crc32_little (unsigned long, const unsigned char *, unsigned);
+local unsigned long crc32_big (unsigned long, const unsigned char *, unsigned);
 
 /* Local functions for crc concatenation */
 local unsigned long gf2_matrix_times (unsigned long *mat, unsigned long vec);
@@ -53,7 +44,7 @@ local uLong crc32_combine_ (uLong crc1, uLong crc2, z_off64_t len2);
 #ifdef DYNAMIC_CRC_TABLE
 
 local volatile int crc_table_empty = 1;
-local z_crc_t crc_table[TBLS][256];
+local z_crc_t crc_table[8][256];
 local void make_crc_table (void);
 #ifdef MAKECRCH
    local void write_table (FILE *, const z_crc_t *);
@@ -112,7 +103,6 @@ local void make_crc_table()
             crc_table[0][n] = c;
         }
 
-#ifdef BYFOUR
         /* generate crc for each value followed by one, two, and three zeros,
            and then the byte reversal of those as well as the first table */
         for (n = 0; n < 256; n++) {
@@ -124,7 +114,6 @@ local void make_crc_table()
                 crc_table[k + 4][n] = ZSWAP32(c);
             }
         }
-#endif /* BYFOUR */
 
         crc_table_empty = 0;
     }
@@ -144,16 +133,12 @@ local void make_crc_table()
         fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n");
         fprintf(out, " * Generated automatically by crc32.c\n */\n\n");
         fprintf(out, "local const z_crc_t ");
-        fprintf(out, "crc_table[TBLS][256] =\n{\n  {\n");
+        fprintf(out, "crc_table[8][256] =\n{\n  {\n");
         write_table(out, crc_table[0]);
-#  ifdef BYFOUR
-        fprintf(out, "#ifdef BYFOUR\n");
         for (k = 1; k < 8; k++) {
             fprintf(out, "  },\n  {\n");
             write_table(out, crc_table[k]);
         }
-        fprintf(out, "#endif\n");
-#  endif /* BYFOUR */
         fprintf(out, "  }\n};\n");
         fclose(out);
     }
@@ -209,7 +194,6 @@ unsigned long ZEXPORT crc32(crc, buf, len)
         make_crc_table();
 #endif /* DYNAMIC_CRC_TABLE */
 
-#ifdef BYFOUR
     if (sizeof(void *) == sizeof(ptrdiff_t)) {
         z_crc_t endian;
 
@@ -219,7 +203,6 @@ unsigned long ZEXPORT crc32(crc, buf, len)
         else
             return crc32_big(crc, buf, len);
     }
-#endif /* BYFOUR */
     crc = crc ^ 0xffffffffUL;
 
 #ifdef CRC32_UNROLL_LESS
@@ -240,7 +223,6 @@ unsigned long ZEXPORT crc32(crc, buf, len)
     return crc ^ 0xffffffffUL;
 }
 
-#ifdef BYFOUR
 
 /* ========================================================================= */
 #define DOLIT4 c ^= *buf4++; \
@@ -326,7 +308,6 @@ local unsigned long crc32_big(unsigned long crc, const unsigned char *buf, unsig
     return (unsigned long)(ZSWAP32(c));
 }
 
-#endif /* BYFOUR */
 
 #define GF2_DIM 32      /* dimension of GF(2) vectors (length of CRC) */
 
diff --git a/crc32.h b/crc32.h
index c2f4c6bc94b9b025a8eb5e9fece76b1ff5cc8b8d..d980aa73bdb7e37de6cd77c7c287fdd60e709fe8 100644 (file)
--- a/crc32.h
+++ b/crc32.h
@@ -2,7 +2,7 @@
  * Generated automatically by crc32.c
  */
 
-local const z_crc_t crc_table[TBLS][256] =
+local const z_crc_t crc_table[8][256] =
 {
   {
     0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
@@ -57,7 +57,6 @@ local const z_crc_t crc_table[TBLS][256] =
     0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL,
     0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL,
     0x2d02ef8dUL
-#ifdef BYFOUR
   },
   {
     0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL,
@@ -436,6 +435,5 @@ local const z_crc_t crc_table[TBLS][256] =
     0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL,
     0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL,
     0xf10605deUL
-#endif
   }
 };