Skip to content

Commit de09caa

Browse files
committed
Bring the C and Python compute_hash functions into consistency
1 parent d72bc27 commit de09caa

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

py/makeqstrdata.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ def compute_hash(qstr):
2727
hash = 5381
2828
for char in qstr:
2929
hash = (hash * 33) ^ ord(char)
30-
return hash & 0xffff
30+
# Make sure that valid hash is never zero, zero means "hash not computed"
31+
return (hash & 0xffff) or 1
3132

3233
def do_work(infiles):
3334
# read the qstrs in from the input files

0 commit comments

Comments
 (0)