File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ def hash_insert_entry(string, i):
6565 hash_val = hashpjw (string )
6666 hash_cursor = hash_val % hash_tab_size
6767 inc = 1 + (hash_val % (hash_tab_size - 2 ))
68- while hash_table [hash_cursor ] != 0 :
68+ while hash_table [hash_cursor ]:
6969 hash_cursor += inc
7070 hash_cursor %= hash_tab_size
7171 hash_table [hash_cursor ] = i + 1
@@ -106,10 +106,9 @@ def hash_insert_entry(string, i):
106106 offsets .append ((len (ids ), len (id ), len (strs ), len (MESSAGES [id ])))
107107 ids += id + b'\0 '
108108 strs += MESSAGES [id ] + b'\0 '
109- output = ''
110- ## FIX ME The header is 7 32-bit unsigned integers. We use hash tables, so
111- # the keys start right after the index tables.
112- # translated string.
109+
110+ # The header is 7 32-bit unsigned integers, and we have an index table and
111+ # hash table.
113112 keystart = 7 * 4 + 16 * len (keys )+ hash_tab_size * 4
114113 # and the values start after the keys
115114 valuestart = keystart + len (ids )
@@ -301,7 +300,7 @@ def hashpjw(str_param):
301300 hval <<= 4
302301 hval += s
303302 g = hval & 0xF << 28
304- if g != 0 :
303+ if g :
305304 hval ^= g >> 24
306305 hval ^= g
307306 return hval
You can’t perform that action at this time.
0 commit comments