From 6512190e8cf23af76fe54eb442d71708aebef127 Mon Sep 17 00:00:00 2001 From: Oldes Date: Fri, 28 Feb 2020 18:49:42 +0100 Subject: [PATCH] CHANGE: renaming CRC_Table to CRC24_Table So it has same naming as CRC32_Table. --- src/core/n-strings.c | 2 +- src/core/s-crc.c | 20 ++++++++++---------- src/core/t-string.c | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/core/n-strings.c b/src/core/n-strings.c index a70cb6d692..3a21f3e28f 100644 --- a/src/core/n-strings.c +++ b/src/core/n-strings.c @@ -291,7 +291,7 @@ static struct digest { i = Hash_String(data, len) % sum; } else { - i = Compute_CRC(data, len); + i = Compute_CRC24(data, len); } DS_RET_INT(i); diff --git a/src/core/s-crc.c b/src/core/s-crc.c index 3abe2cd571..093f439335 100644 --- a/src/core/s-crc.c +++ b/src/core/s-crc.c @@ -39,12 +39,12 @@ #define PRZCRC 0x864cfb /* PRZ's 24-bit CRC generator polynomial */ #define CRCINIT 0xB704CE /* Init value for CRC accumulator */ -static REBCNT *CRC_Table; +static REBCNT *CRC24_Table; static REBCNT *CRC32_Table = 0; /*********************************************************************** ** -*/ static REBCNT Generate_CRC(REBYTE ch, REBCNT poly, REBCNT accum) +*/ static REBCNT Generate_CRC24(REBYTE ch, REBCNT poly, REBCNT accum) /* ** Simulates CRC hardware circuit. Generates true CRC ** directly, without requiring extra NULL bytes to be appended @@ -96,7 +96,7 @@ static REBCNT *CRC32_Table = 0; /*********************************************************************** ** -*/ static void Make_CRC_Table(REBCNT poly) +*/ static void Make_CRC24_Table(REBCNT poly) /* ** Derives a CRC lookup table from the CRC polynomial. ** The table is used later by crcupdate function given below. @@ -106,13 +106,13 @@ static REBCNT *CRC32_Table = 0; { REBINT i; - FOREACH (i, 256) CRC_Table[i] = Generate_CRC((REBYTE) i, poly, 0); + FOREACH (i, 256) CRC24_Table[i] = Generate_CRC24((REBYTE) i, poly, 0); } /*********************************************************************** ** -*/ REBINT Compute_CRC(REBYTE *str, REBCNT len) +*/ REBINT Compute_CRC24(REBYTE *str, REBCNT len) /* ***********************************************************************/ { @@ -121,7 +121,7 @@ static REBCNT *CRC32_Table = 0; for (; len > 0; len--) { n = (REBYTE)((crc >> CRCSHIFTS) ^ (REBYTE)(*str++)); - crc = MASK_CRC(crc << 8) ^ (REBINT)CRC_Table[n]; + crc = MASK_CRC(crc << 8) ^ (REBINT)CRC24_Table[n]; } return crc; @@ -142,7 +142,7 @@ static REBCNT *CRC32_Table = 0; for (; len > 0; len--) { n = (REBYTE)((hash >> CRCSHIFTS) ^ (REBYTE)LO_CASE(*str++)); - hash = MASK_CRC(hash << 8) ^ (REBINT)CRC_Table[n]; + hash = MASK_CRC(hash << 8) ^ (REBINT)CRC24_Table[n]; } return hash; @@ -172,7 +172,7 @@ static REBCNT *CRC32_Table = 0; if (n > 127 && NZ(m = Decode_UTF8_Char(&str, &ulen))) n = m; // mods str, ulen if (n < UNICODE_CASES) n = LO_CASE(n); n = (REBYTE)((hash >> CRCSHIFTS) ^ (REBYTE)n); // drop upper 8 bits - hash = MASK_CRC(hash << 8) ^ (REBINT)CRC_Table[n]; + hash = MASK_CRC(hash << 8) ^ (REBINT)CRC24_Table[n]; } return hash; @@ -324,8 +324,8 @@ static REBCNT *CRC32_Table = 0; /* ***********************************************************************/ { - CRC_Table = Make_Mem(sizeof(REBCNT) * 256); - Make_CRC_Table(PRZCRC); + CRC24_Table = Make_Mem(sizeof(REBCNT) * 256); + Make_CRC24_Table(PRZCRC); } diff --git a/src/core/t-string.c b/src/core/t-string.c index 44565dc51f..f403c0f3e5 100644 --- a/src/core/t-string.c +++ b/src/core/t-string.c @@ -717,7 +717,7 @@ static REBSER *make_binary(REBVAL *arg, REBOOL make) case A_RANDOM: if(IS_PROTECT_SERIES(VAL_SERIES(value))) Trap0(RE_PROTECTED); if (D_REF(2)) { // seed - Set_Random(Compute_CRC(VAL_BIN_DATA(value), VAL_LEN(value))); + Set_Random(Compute_CRC24(VAL_BIN_DATA(value), VAL_LEN(value))); return R_UNSET; } if (D_REF(4)) { // /only