Skip to content

Commit

Permalink
lib: Kconfig: Move DYNAMIC_CRC_TABLE to Kconfig
Browse files Browse the repository at this point in the history
Add CONFIG prefix to DYNAMIC_CRC_TABLE and implement it in
Kconfig.

Signed-off-by: Faiz Abbas <[email protected]>
  • Loading branch information
Faiz-Abbas authored and trini committed Feb 14, 2018
1 parent 7e63ba2 commit 36c1877
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions lib/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ config CC_OPTIMIZE_LIBS_FOR_SPEED

If unsure, say N.

config DYNAMIC_CRC_TABLE
bool "Enable Dynamic tables for CRC"
help
Enable this option to calculate entries for CRC tables at runtime.
This can be helpful when reducing the size of the build image

config HAVE_PRIVATE_LIBGCC
bool

Expand Down
6 changes: 3 additions & 3 deletions lib/crc32.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#define tole(x) cpu_to_le32(x)

#ifdef DYNAMIC_CRC_TABLE
#ifdef CONFIG_DYNAMIC_CRC_TABLE

local int crc_table_empty = 1;
local uint32_t crc_table[256];
Expand Down Expand Up @@ -157,7 +157,7 @@ tole(0xb40bbe37L), tole(0xc30c8ea1L), tole(0x5a05df1bL), tole(0x2d02ef8dL)
*/
const uint32_t * ZEXPORT get_crc_table()
{
#ifdef DYNAMIC_CRC_TABLE
#ifdef CONFIG_DYNAMIC_CRC_TABLE
if (crc_table_empty) make_crc_table();
#endif
return (const uint32_t *)crc_table;
Expand All @@ -181,7 +181,7 @@ uint32_t ZEXPORT crc32_no_comp(uint32_t crc, const Bytef *buf, uInt len)
const uint32_t *tab = crc_table;
const uint32_t *b =(const uint32_t *)buf;
size_t rem_len;
#ifdef DYNAMIC_CRC_TABLE
#ifdef CONFIG_DYNAMIC_CRC_TABLE
if (crc_table_empty)
make_crc_table();
#endif
Expand Down

0 comments on commit 36c1877

Please sign in to comment.