Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
180751fb
Commit
180751fb
authored
Jun 07, 2014
by
Paul Sokolovsky
Browse files
Merge pull request #670 from Rosuav/stringhash
Bring the C and Python compute_hash functions into consistency
parents
d72bc271
de09caaa
Changes
1
Hide whitespace changes
Inline
Side-by-side
py/makeqstrdata.py
View file @
180751fb
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment