From b28e961740cdbf261cd4ddeba064b89b54249495 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Sat, 11 Apr 2015 11:27:16 -0700 Subject: [PATCH] split table index to separate line --- crc32.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crc32.c b/crc32.c index 68594f2..8427ea7 100644 --- a/crc32.c +++ b/crc32.c @@ -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; }