more type work

modern
Connor Olding 8 years ago
parent 2ce38461bb
commit 58f9e4591e

@ -53,14 +53,14 @@ crc_le_fill_table(uint32_t *table, uint32_t polynomial)
}
static inline void
crc_be_cycle(uint32_t *table, uint32_t *remainder, char c)
crc_be_cycle(uint32_t *table, uint32_t *remainder, uint8_t c)
{
const uint32_t byte = table[(((*remainder) >> 24) ^ c) & 0xFF];
*remainder = (((*remainder) << 8) ^ byte) & 0xFFFFFFFF;
const uint32_t byte = table[(((*remainder) >> 24) ^ c)];
*remainder = (((*remainder) << 8) ^ byte);
}
static inline void
crc_le_cycle(uint32_t *table, uint32_t *remainder, char c)
crc_le_cycle(uint32_t *table, uint32_t *remainder, uint8_t c)
{
const uint32_t byte = table[((*remainder) ^ c) & 0xFF];
*remainder = ((*remainder) >> 8) ^ byte;

@ -123,8 +123,8 @@ static uint32_t
cycle_file(FILE *stream)
{
uint32_t remainder = starting;
void (*cycle)(uint32_t*, uint32_t*, char) =
(big_endian) ? crc_be_cycle : crc_le_cycle;
typeof(&crc_be_cycle) cycle;
cycle = (big_endian) ? crc_be_cycle : crc_le_cycle;
uint32_t table[CRC_TABLE_SIZE];
if (big_endian)

Loading…
Cancel
Save