Skip to content

Commit 89e3158

Browse files
zsxOldes
authored andcommitted
ATRONIX: Use constant macros instead of suffix
To maximize the cross-platform compatibility (cherry picked from commit a744203)
1 parent c392919 commit 89e3158

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/core/s-crc.c

+4-8
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
#define CRC_DEFINED
3333

3434
#define CRCBITS 24 /* may be 16, 24, or 32 */
35-
#define MASK_CRC(crc) ((crc) & 0x00ffffffL) /* if CRCBITS is 24 */
36-
#define CRCHIBIT ((REBCNT) (1L<<(CRCBITS-1))) /* 0x8000 if CRCBITS is 16 */
35+
#define MASK_CRC(crc) ((crc) & I32_C(0x00ffffff)) /* if CRCBITS is 24 */
36+
#define CRCHIBIT ((REBCNT) (I32_C(1)<<(CRCBITS-1))) /* 0x8000 if CRCBITS is 16 */
3737
#define CRCSHIFTS (CRCBITS-8)
3838
#define CCITTCRC 0x1021 /* CCITT's 16-bit CRC generator polynomial */
3939
#define PRZCRC 0x864cfb /* PRZ's 24-bit CRC generator polynomial */
@@ -368,11 +368,7 @@ static void Make_CRC32_Table(void) {
368368
c=(u32)n;
369369
for(k=0;k<8;k++) {
370370
if(c&1)
371-
#ifdef __LP64__
372-
c=0xedb88320^(c>>1);
373-
#else
374-
c=0xedb88320L^(c>>1);
375-
#endif
371+
c=U32_C(0xedb88320)^(c>>1);
376372
else
377373
c=c>>1;
378374
}
@@ -398,7 +394,7 @@ REBCNT Update_CRC32(u32 crc, REBYTE *buf, int len) {
398394
/*
399395
***********************************************************************/
400396
{
401-
return Update_CRC32(0x00000000L, buf, len);
397+
return Update_CRC32(U32_C(0x00000000), buf, len);
402398
}
403399

404400

0 commit comments

Comments
 (0)