]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
IMPORT: slz: do not produce the crc32_fast table when CRC is natively supported
authorWilly Tarreau <w@1wt.eu>
Wed, 12 May 2021 06:36:09 +0000 (08:36 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 12 May 2021 07:29:33 +0000 (09:29 +0200)
On ARM with native CRC support, no need to inflate the executable with
a 4kB CRC table, let's just drop it.

This is slz upstream commit d8715db20b2968d1f3012a734021c0978758f911.

include/import/slz-tables.h
src/slz.c

index ff6c93901fc37c274bf6b61cca22133f30e27b9a..8e8b679fbbf3ac3061e04ebda5ae3daa6a3eb375 100644 (file)
@@ -124,9 +124,13 @@ static const uint32_t len_fh[259] = {
        0x0d1d23,  0x0d1e23,  0x0800a3               /* 256-258 */
 };
 
+#if !defined(__ARM_FEATURE_CRC32)
 static uint32_t crc32_fast[4][256];
+#endif
+
 static uint32_t fh_dist_table[32768];
 
+#if !defined(__ARM_FEATURE_CRC32)
 /* Make the table for a fast CRC.
  * Not thread-safe, must be called exactly once.
  */
@@ -159,6 +163,7 @@ static inline void __slz_make_crc_table(void)
                crc32_fast[3][n] = 0xff000000 ^ crc32_fast[0][(0x0000ff00 ^ crc32_fast[2][n] ^ 0xff) & 0xff] ^ (crc32_fast[2][n] >> 8);
        }
 }
+#endif
 
 /* Returns code for lengths 1 to 32768. The bit size for the next value can be
  * found this way :
index 76e89e20e2d42215cc743214d88296ccb40ffa92..231e09c0913bf594c8bb572e364b6c7b7cb6b10d 100644 (file)
--- a/src/slz.c
+++ b/src/slz.c
@@ -1307,6 +1307,8 @@ int slz_rfc1950_finish(struct slz_stream *strm, unsigned char *buf)
 __attribute__((constructor))
 static void __slz_initialize(void)
 {
+#if !defined(__ARM_FEATURE_CRC32)
        __slz_make_crc_table();
+#endif
        __slz_prepare_dist_table();
 }