Skip to content

Commit

Permalink
Make the crc32 big-endian computation use pointer post-increment like…
Browse files Browse the repository at this point in the history
… the little-endian version was already doing
  • Loading branch information
pascal-cuoq committed Sep 25, 2016
1 parent e89205b commit 8056c7d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions crc32.c
Expand Up @@ -282,7 +282,7 @@ local unsigned long crc32_little(crc, buf, len)

/* ========================================================================= */
#define DOBIG4 \
memcpy(&bufword, ++buf4, sizeof(z_crc_t)); \
memcpy(&bufword, buf4++, sizeof(z_crc_t)); \
c ^= bufword; \
c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \
crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24]
Expand All @@ -306,7 +306,6 @@ local unsigned long crc32_big(crc, buf, len)
}

buf4 = (const z_crc_t FAR *)(const void FAR *)buf;
buf4--;
while (len >= 32) {
DOBIG32;
len -= 32;
Expand All @@ -315,7 +314,6 @@ local unsigned long crc32_big(crc, buf, len)
DOBIG4;
len -= 4;
}
buf4++;
buf = (const unsigned char FAR *)buf4;

if (len) do {
Expand Down

0 comments on commit 8056c7d

Please sign in to comment.