X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/d9a64523371fa019c4575bb400cbbc3a50ac9903..HEAD:/libkern/zlib/z_crc32.c diff --git a/libkern/zlib/z_crc32.c b/libkern/zlib/z_crc32.c index ac0acac44..458fb87d3 100644 --- a/libkern/zlib/z_crc32.c +++ b/libkern/zlib/z_crc32.c @@ -281,8 +281,8 @@ z_crc32(unsigned long crc, const unsigned char FAR *buf, unsigned len) /* ========================================================================= */ #define DOLIT4 c ^= *buf4++; \ - c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ - crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24] + c = (u4)(crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ + crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24]) #define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 /* ========================================================================= */ @@ -295,7 +295,7 @@ crc32_little(unsigned long crc, const unsigned char FAR *buf, unsigned len) c = (u4)crc; c = ~c; while (len && ((ptrdiff_t)buf & 3)) { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); + c = (u4)(crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8)); len--; } @@ -311,7 +311,7 @@ crc32_little(unsigned long crc, const unsigned char FAR *buf, unsigned len) buf = (const unsigned char FAR *)buf4; if (len) do { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); + c = (u4)(crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8)); } while (--len); c = ~c; return (unsigned long)c; @@ -319,8 +319,8 @@ crc32_little(unsigned long crc, const unsigned char FAR *buf, unsigned len) /* ========================================================================= */ #define DOBIG4 c ^= *++buf4; \ - c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ - crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] + c = (u4)(crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ + crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24]) #define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 /* ========================================================================= */ @@ -333,7 +333,7 @@ crc32_big(unsigned long crc, const unsigned char FAR *buf, unsigned len) c = REV((u4)crc); c = ~c; while (len && ((ptrdiff_t)buf & 3)) { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); + c = (u4)(crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8)); len--; } @@ -351,7 +351,7 @@ crc32_big(unsigned long crc, const unsigned char FAR *buf, unsigned len) buf = (const unsigned char FAR *)buf4; if (len) do { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); + c = (u4)(crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8)); } while (--len); c = ~c; return (unsigned long)(REV(c));