From 2a41f0d2a4df26bc4694870af76551ec2b5d0611 Mon Sep 17 00:00:00 2001 From: Tim 'mithro' Ansell Date: Mon, 2 Sep 2019 14:48:30 -0700 Subject: [PATCH] Use `SMALL_CRC` to enable smaller CRC versions. @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 | 3 ++- litex/soc/software/libbase/crc32.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/litex/soc/software/libbase/crc16.c b/litex/soc/software/libbase/crc16.c index 82e3102b..a14d0ed8 100644 --- a/litex/soc/software/libbase/crc16.c +++ b/litex/soc/software/libbase/crc16.c @@ -1,5 +1,6 @@ #include -#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, diff --git a/litex/soc/software/libbase/crc32.c b/litex/soc/software/libbase/crc32.c index 7690ac09..b8b58a76 100644 --- a/litex/soc/software/libbase/crc32.c +++ b/litex/soc/software/libbase/crc32.c @@ -5,7 +5,7 @@ #include -#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 -- 2.30.2