Scope of recent changes.

This commit is contained in:
Alexander S. Aganichev
2003-12-10 08:35:16 +00:00
parent 9548bafcac
commit 5ed34a60fb
88 changed files with 649 additions and 748 deletions

View File

@@ -9,7 +9,7 @@ else
ifeq ($(TERM),cygwin)
INCS+=-I$(TOP)/goldlib/glibc
else
ifeq ($(TERM),MSYS)
ifeq ($(TERM),msys)
INCS+=-I$(TOP)/goldlib/glibc
endif
endif

View File

@@ -52,6 +52,7 @@ extern dword __crc32_table[];
// prototyped unsigned parameters anyway, so we have no problem here.
inline word updCrc16(byte ch, word crc) { return (word)(__crc16_table[byte(crc >> 8)] ^ (crc << 8) ^ (ch)); }
inline word updCrc16c(byte ch, word crc) { return (word)(__crc16_table[byte(crc >> 8) ^ (ch)] ^ (crc << 8)); }
inline dword updCrc32(byte ch, dword crc) { return (dword)(__crc32_table[byte(crc) ^ byte(ch)] ^ (crc >> 8)); }
@@ -68,6 +69,7 @@ const dword CRC32_MASK_CCITT = 0xFFFFFFFFUL;
// Prototypes
word strCrc16(const char* s, bool nocase=true, word mask=CRC16_MASK_NORMAL);
word strCrc16c(const char* s, bool nocase=true, word mask=CRC16_MASK_NORMAL);
dword strCrc32(const char* s, bool nocase=true, dword mask=CRC32_MASK_NORMAL);
dword strHash32(const char* s, bool nocase=true);

View File

@@ -49,5 +49,25 @@ word strCrc16(const char* s, bool __case, word mask) {
}
// ------------------------------------------------------------------
// Generate bugfree CRC-16 of a normal nul-terminated string
word strCrc16c(const char* s, bool __case, word mask) {
word crc = mask;
if(__case) {
while(*s)
crc = updCrc16c(toupper(*s++), crc);
}
else {
while(*s)
crc = updCrc16c(*s++, crc);
}
return crc;
}
// ------------------------------------------------------------------