defStringHash(s,seed,max):""" Python version of StringHash from string_lib.c """h=np.uint32(seed)foriinbytearray(s):h+=np.uint32(i)h+=np.uint32(h<<10)h^=np.uint32(h>>6)h+=np.uint32(h<<3)h^=np.uint32(h>>11)h+=np.uint32(h<<15)returnnp.uint32(h&(max-1))

I was struggling with integers overflow for my cfe-rsplaytime quick hack.