Skip to content

Commit e477f2e

Browse files
committed
Always use 32-bit integers for CRC
1 parent c26cc2b commit e477f2e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/core/s-crc.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -358,16 +358,20 @@ static REBCNT *CRC_Table;
358358
static u32 *crc32_table = 0;
359359

360360
static void Make_CRC32_Table(void) {
361-
unsigned long c;
361+
u32 c;
362362
int n,k;
363363

364364
crc32_table = Make_Mem(256 * sizeof(u32));
365365

366366
for(n=0;n<256;n++) {
367-
c=(unsigned long)n;
367+
c=(u32)n;
368368
for(k=0;k<8;k++) {
369369
if(c&1)
370+
#ifdef __LP64__
371+
c=0xedb88320^(c>>1);
372+
#else
370373
c=0xedb88320L^(c>>1);
374+
#endif
371375
else
372376
c=c>>1;
373377
}

0 commit comments

Comments
 (0)