From de09caaa37b1b575660d2f9a22527325662afc41 Mon Sep 17 00:00:00 2001
From: Chris Angelico <rosuav@gmail.com>
Date: Sat, 7 Jun 2014 06:55:27 +1000
Subject: [PATCH] Bring the C and Python compute_hash functions into
 consistency

---
 py/makeqstrdata.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/py/makeqstrdata.py b/py/makeqstrdata.py
index 2ec5a1fb6..599b936f9 100644
--- a/py/makeqstrdata.py
+++ b/py/makeqstrdata.py
@@ -27,7 +27,8 @@ def compute_hash(qstr):
     hash = 5381
     for char in qstr:
         hash = (hash * 33) ^ ord(char)
-    return hash & 0xffff
+    # Make sure that valid hash is never zero, zero means "hash not computed"
+    return (hash & 0xffff) or 1
 
 def do_work(infiles):
     # read the qstrs in from the input files
-- 
GitLab