split table index to separate line
This commit is contained in:
parent
0226973efa
commit
b28e961740
1 changed files with 6 additions and 4 deletions
10
crc32.c
10
crc32.c
|
@ -55,13 +55,15 @@ crc_le_fill_table(uint32_t *table, uint32_t polynomial)
|
||||||
static inline void
|
static inline void
|
||||||
crc_be_cycle(uint32_t *table, uint32_t *remainder, uint8_t c)
|
crc_be_cycle(uint32_t *table, uint32_t *remainder, uint8_t c)
|
||||||
{
|
{
|
||||||
const uint32_t byte = table[(((*remainder) >> 24) ^ c)];
|
const uint8_t i = ((*remainder) >> 24) ^ c;
|
||||||
*remainder = (((*remainder) << 8) ^ byte);
|
const uint32_t next = table[i];
|
||||||
|
*remainder = ((*remainder) << 8) ^ next;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
crc_le_cycle(uint32_t *table, uint32_t *remainder, uint8_t c)
|
crc_le_cycle(uint32_t *table, uint32_t *remainder, uint8_t c)
|
||||||
{
|
{
|
||||||
const uint32_t byte = table[((*remainder) ^ c) & 0xFF];
|
const uint8_t i = (*remainder) ^ c;
|
||||||
*remainder = ((*remainder) >> 8) ^ byte;
|
const uint32_t next = table[i];
|
||||||
|
*remainder = ((*remainder) >> 8) ^ next;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue