Skip to content

Commit

Permalink
Use constant macros instead of suffix
Browse files Browse the repository at this point in the history
To maximize the cross-platform compatibility
  • Loading branch information
zsx committed May 13, 2014
1 parent 29fb4b3 commit a744203
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/core/s-crc.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
#define CRC_DEFINED

#define CRCBITS 24 /* may be 16, 24, or 32 */
#define MASK_CRC(crc) ((crc) & 0x00ffffffL) /* if CRCBITS is 24 */
#define CRCHIBIT ((REBCNT) (1L<<(CRCBITS-1))) /* 0x8000 if CRCBITS is 16 */
#define MASK_CRC(crc) ((crc) & I32_C(0x00ffffff)) /* if CRCBITS is 24 */
#define CRCHIBIT ((REBCNT) (I32_C(1)<<(CRCBITS-1))) /* 0x8000 if CRCBITS is 16 */
#define CRCSHIFTS (CRCBITS-8)
#define CCITTCRC 0x1021 /* CCITT's 16-bit CRC generator polynomial */
#define PRZCRC 0x864cfb /* PRZ's 24-bit CRC generator polynomial */
Expand Down Expand Up @@ -367,11 +367,7 @@ static void Make_CRC32_Table(void) {
c=(u32)n;
for(k=0;k<8;k++) {
if(c&1)
#ifdef __LP64__
c=0xedb88320^(c>>1);
#else
c=0xedb88320L^(c>>1);
#endif
c=U32_C(0xedb88320)^(c>>1);
else
c=c>>1;
}
Expand All @@ -397,7 +393,7 @@ REBCNT Update_CRC32(u32 crc, REBYTE *buf, int len) {
/*
***********************************************************************/
{
return Update_CRC32(0x00000000L, buf, len);
return Update_CRC32(U32_C(0x00000000), buf, len);
}


Expand Down

0 comments on commit a744203

Please sign in to comment.