diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2023-08-25 20:17:49 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2023-08-28 09:19:33 +0200 |
commit | 0fa2d4866808761416d53083779149017f4a53de (patch) | |
tree | 576a8e6b1a40111834ded07a05a2320f6dcc72c7 /crypto/crc32.c | |
parent | 025eef8192189327a8fef8412b7df0935d016840 (diff) | |
download | barebox-0fa2d4866808761416d53083779149017f4a53de.tar.gz barebox-0fa2d4866808761416d53083779149017f4a53de.tar.xz |
crypto: crc32: use uint32_t instead of ulong
Using ulong just wastes space on 64-bit platforms, so use fixed size
32-bit integers instead.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230825181749.2861735-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'crypto/crc32.c')
-rw-r--r-- | crypto/crc32.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crypto/crc32.c b/crypto/crc32.c index 998cbc9de2..95cb2212db 100644 --- a/crypto/crc32.c +++ b/crypto/crc32.c @@ -24,7 +24,7 @@ #ifdef CONFIG_DYNAMIC_CRC_TABLE -static ulong *crc_table; +static uint32_t *crc_table; /* Generate a table for a byte-wise 32-bit CRC calculation on the polynomial: @@ -52,22 +52,22 @@ static ulong *crc_table; */ static void make_crc_table(void) { - ulong c; + uint32_t c; int n, k; - ulong poly; /* polynomial exclusive-or pattern */ + uint32_t poly; /* polynomial exclusive-or pattern */ /* terms of polynomial defining this crc (except x^32): */ static const char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; /* make exclusive-or pattern from polynomial (0xedb88320L) */ - poly = 0L; + poly = 0; for (n = 0; n < sizeof(p)/sizeof(char); n++) - poly |= 1L << (31 - p[n]); + poly |= 1U << (31 - p[n]); - crc_table = xmalloc(sizeof(ulong) * 256); + crc_table = xmalloc(sizeof(uint32_t) * 256); for (n = 0; n < 256; n++) { - c = (ulong)n; + c = (uint32_t)n; for (k = 0; k < 8; k++) c = c & 1 ? poly ^ (c >> 1) : c >> 1; crc_table[n] = c; @@ -77,7 +77,7 @@ static void make_crc_table(void) /* ======================================================================== * Table of CRC-32's of all single-byte values (made by make_crc_table) */ -static const ulong crc_table[256] = { +static const uint32_t crc_table[256] = { 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, |