flake8 Tests/make_hash.py

This commit is contained in:
hugovk 2014-06-25 12:25:51 +03:00
parent 1bbe850f5b
commit 3b3fc441b1

View File

@ -1,7 +1,5 @@
# brute-force search for access descriptor hash table
import random
modes = [
"1",
"L", "LA",
@ -13,12 +11,14 @@ modes = [
"YCbCr",
]
def hash(s, i):
# djb2 hash: multiply by 33 and xor character
for c in s:
i = (((i<<5) + i) ^ ord(c)) & 0xffffffff
i = (((i << 5) + i) ^ ord(c)) & 0xffffffff
return i
def check(size, i0):
h = [None] * size
for m in modes: