Switch the preprocessor over to using the hash table library
[platform/upstream/nasm.git] / crc64.c
diff --git a/crc64.c b/crc64.c
index 4a49010..be9a15b 100644 (file)
--- a/crc64.c
+++ b/crc64.c
@@ -1,4 +1,5 @@
 #include <inttypes.h>
+#include <ctype.h>
 
 static const uint64_t crc64_tab[256] = {
     UINT64_C(0x0000000000000000), UINT64_C(0x7ad870c830358979),
@@ -142,3 +143,16 @@ uint64_t crc64(const char *str)
 
     return crc;
 }
+
+uint64_t crc64i(const char *str)
+{
+    uint64_t crc = UINT64_C(0xffffffffffffffff);
+    uint8_t c;
+
+    while ((c = *str++) != 0) {
+       c = tolower(c);
+       crc = crc64_tab[(uint8_t)crc ^ c] ^ (crc >> 8);
+    }
+
+    return crc;
+}