Skip to content

Commit c392919

Browse files
zsxOldes
authored andcommitted
ATRONIX: Always use 32-bit integers for CRC
(cherry picked from commit e477f2e)
1 parent 7c97bd6 commit c392919

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
@@ -359,16 +359,20 @@ static REBCNT *CRC32_Table = 0;
359359

360360

361361
static void Make_CRC32_Table(void) {
362-
unsigned long c;
362+
u32 c;
363363
int n,k;
364364

365365
CRC32_Table = Make_Mem(256 * sizeof(u32));
366366

367367
for(n=0;n<256;n++) {
368-
c=(unsigned long)n;
368+
c=(u32)n;
369369
for(k=0;k<8;k++) {
370370
if(c&1)
371+
#ifdef __LP64__
372+
c=0xedb88320^(c>>1);
373+
#else
371374
c=0xedb88320L^(c>>1);
375+
#endif
372376
else
373377
c=c>>1;
374378
}

0 commit comments

Comments
 (0)