1
# brute-force search for access descriptor hash table
8
"I", "I;16", "I;16L", "I;16B", "I;32L", "I;32B",
11
"RGB", "RGBA", "RGBa", "RGBX",
17
# djb2 hash: multiply by 33 and xor character
19
i = (((i<<5) + i) ^ ord(c)) & 0xffffffff
34
# 1) find the smallest table size with no collisions
35
for min_size in range(len(modes), 16384):
36
if check(min_size, 0):
37
print(len(modes), "modes fit in", min_size, "slots")
40
# 2) see if we can do better with a different initial value
41
for i0 in range(65556):
42
for size in range(1, min_size):
45
print(len(modes), "modes fit in", size, "slots with start", i0)
51
# print check(min_size, min_start)
53
print("#define ACCESS_TABLE_SIZE", min_size)
54
print("#define ACCESS_TABLE_HASH", min_start)
57
# print m, "=>", hash(m, min_start) % min_size