[libxml2] Improve the hashing functions



commit b123711189344eb0f8a07acd9d8feff572973db9
Author: Daniel Franke <dafranke akamai com>
Date:   Fri Apr 12 18:53:53 2013 +0800

    Improve the hashing functions

 hash.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/hash.c b/hash.c
index afabcb1..0145109 100644
--- a/hash.c
+++ b/hash.c
@@ -93,11 +93,13 @@ xmlHashComputeKey(xmlHashTablePtr table, const xmlChar *name,
            value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
        }
     }
+    value = value ^ ((value << 5) + (value >> 3));
     if (name2 != NULL) {
        while ((ch = *name2++) != 0) {
            value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
        }
     }
+    value = value ^ ((value << 5) + (value >> 3));
     if (name3 != NULL) {
        while ((ch = *name3++) != 0) {
            value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
@@ -133,6 +135,7 @@ xmlHashComputeQKey(xmlHashTablePtr table,
            value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
        }
     }
+    value = value ^ ((value << 5) + (value >> 3));
     if (prefix2 != NULL) {
        while ((ch = *prefix2++) != 0) {
            value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
@@ -144,6 +147,7 @@ xmlHashComputeQKey(xmlHashTablePtr table,
            value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);
        }
     }
+    value = value ^ ((value << 5) + (value >> 3));
     if (prefix3 != NULL) {
        while ((ch = *prefix3++) != 0) {
            value = value ^ ((value << 5) + (value >> 3) + (unsigned long)ch);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]