zhash.c
changeset 16 b4e251400e36
parent 13 f71e89074c62
child 32 6a1a709330bf
--- a/zhash.c	Sat Sep 01 00:50:11 2007 +0200
+++ b/zhash.c	Sat Sep 01 01:19:18 2007 +0200
@@ -57,18 +57,19 @@
 
 static unsigned int hash_func(const unsigned char *str)
 {
-    int res;
-    char v;
+    unsigned int v;
 
-    v = 0;
+    /* for hashmax of 2^16 */
 
-    /* Taking only the meaningful utf-8 codes */
+    v = (str[1] & 15) << 4*3;
     if (str[2] != 0)
-        v = str[3];
+        v += (str[3] & 15) << 4*2;
+    if (str[4] != 0)
+        v += (str[5] & 15) << 4;
+    if (str[6] != 0)
+        v += (str[7] & 15);
 
-    res = (str[1] << 8) + v;
-
-    return res;
+    return v;
 }
 
 /* Word without accent */
@@ -135,6 +136,7 @@
     unsigned int hash_num;
 
     remove_accent(word_no_accent, word);
+    remove_jo(word_no_accent);
 
     hash_num = hash_func(word_no_accent);