Changeset: 34cb8b7b6647 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/34cb8b7b6647
Modified Files:
        monetdb5/modules/mal/pp_hash.h
Branch: default
Log Message:

use unsigned arithmetic to have defined behaviour on overflow.


diffs (19 lines):

diff --git a/monetdb5/modules/mal/pp_hash.h b/monetdb5/modules/mal/pp_hash.h
--- a/monetdb5/modules/mal/pp_hash.h
+++ b/monetdb5/modules/mal/pp_hash.h
@@ -123,13 +123,13 @@ static inline lng
 str_hsh( str v )
 {
     // Source: https://github.com/aappleby/smhasher/blob/master/src/Hashes.cpp
-    lng h = 2166136261UL;
+    oid h = 2166136261UL;
     const uint8_t* data = (const uint8_t*)v;
     for (int i = 0; data[i]; i++) {
         h ^= data[i];
         h *= 16777619;
     }
-    return h;
+    return (lng)h;
 }
 
 extern hash_table *ht_create(int type, size_t size, hash_table *p, int vkey);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to