Skip to content

Commit a92e6f1

Browse files
Address feedback
1 parent a16a6c3 commit a92e6f1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Tools/i18n/msgfmt.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from email.parser import HeaderParser
3535
import codecs
3636

37-
__version__ = "1.3"
37+
__version__ = "1.2"
3838

3939

4040
MESSAGES = {}
@@ -121,7 +121,7 @@ def hash_insert_entry(string, i):
121121
voffsets += [l2, o2+valuestart]
122122
offsets = koffsets + voffsets
123123
output = struct.pack("Iiiiiii",
124-
0x950412de, # Magic
124+
0x950412de, # Magic
125125
0, # Version
126126
len(keys), # # of entries
127127
7*4, # start of key index
@@ -292,14 +292,16 @@ def main():
292292

293293
# Utilities for writing hash table
294294

295-
def hashpjw(str_param):
295+
# Peter J. Weinberger hash function
296+
# See: https://www.drdobbs.com/database/hashing-rehashed/184409859
297+
def hashpjw(strs):
296298
hval = 0
297-
for s in str_param:
299+
for s in strs:
298300
if not s:
299301
break
300302
hval <<= 4
301303
hval += s
302-
g = hval & 0xF << 28
304+
g = hval & (0xF << 28)
303305
if g:
304306
hval ^= g >> 24
305307
hval ^= g

0 commit comments

Comments
 (0)