Use `SMALL_CRC` to enable smaller CRC versions.
authorTim 'mithro' Ansell <me@mith.ro>
Mon, 2 Sep 2019 21:48:30 +0000 (14:48 -0700)
committerTim 'mithro' Ansell <me@mith.ro>
Mon, 2 Sep 2019 21:48:30 +0000 (14:48 -0700)
@xobs created a smaller code size version of the CRC functions. Enable
these if someone uses the `SMALL_CRC` define.

litex/soc/software/libbase/crc16.c
litex/soc/software/libbase/crc32.c

index 82e3102b139e405fe64777c3e55ddf9d591d9a4a..a14d0ed8f6f6ada9d968b7a5649deb1a8d139c90 100644 (file)
@@ -1,5 +1,6 @@
 #include <crc.h>
-#ifdef CRC16_FAST
+
+#ifndef SMALL_CRC
 static const unsigned int crc16_table[256] = {
        0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7,
        0x8108, 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF,
index 7690ac090d89761df2590fd33459bbfd663f78c1..b8b58a76558470ac3bbebffba9f56a1c6151dba2 100644 (file)
@@ -5,7 +5,7 @@
 
 #include <crc.h>
 
-#ifdef CRC32_FAST
+#ifndef SMALL_CRC
 static const unsigned int crc_table[256] = {
        0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L,
        0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L,
@@ -99,4 +99,4 @@ unsigned int crc32(const unsigned char *message, unsigned int len) {
    }
    return ~crc;
 }
-#endif
\ No newline at end of file
+#endif