split table index to separate line

This commit is contained in:
Connor Olding 2015-04-11 11:27:16 -07:00
parent 0226973efa
commit b28e961740
1 changed files with 6 additions and 4 deletions

10
crc32.c
View File

@ -55,13 +55,15 @@ crc_le_fill_table(uint32_t *table, uint32_t polynomial)
static inline void
crc_be_cycle(uint32_t *table, uint32_t *remainder, uint8_t c)
{
const uint32_t byte = table[(((*remainder) >> 24) ^ c)];
*remainder = (((*remainder) << 8) ^ byte);
const uint8_t i = ((*remainder) >> 24) ^ c;
const uint32_t next = table[i];
*remainder = ((*remainder) << 8) ^ next;
}
static inline void
crc_le_cycle(uint32_t *table, uint32_t *remainder, uint8_t c)
{
const uint32_t byte = table[((*remainder) ^ c) & 0xFF];
*remainder = ((*remainder) >> 8) ^ byte;
const uint8_t i = (*remainder) ^ c;
const uint32_t next = table[i];
*remainder = ((*remainder) >> 8) ^ next;
}