]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - common.c
add a CRC_Block_CaseInsensitive that tolowers its input for use by hash functions...
[xonotic/darkplaces.git] / common.c
index aaa9fd6859ac9c0cc89a010df177e4cca0b14f71..b648b017fc1b0dd19f8ccabec1c1d6a8bac87e86 100644 (file)
--- a/common.c
+++ b/common.c
@@ -173,6 +173,14 @@ unsigned short CRC_Block(const unsigned char *data, size_t size)
        return crc ^ CRC_XOR_VALUE;
 }
 
+unsigned short CRC_Block_CaseInsensitive(const unsigned char *data, size_t size)
+{
+       unsigned short crc = CRC_INIT_VALUE;
+       while (size--)
+               crc = (crc << 8) ^ crctable[(crc >> 8) ^ (tolower(*data++))];
+       return crc ^ CRC_XOR_VALUE;
+}
+
 // QuakeWorld
 static unsigned char chktbl[1024 + 4] =
 {