error when porting C code to Python (bitwise manipulation)
Jordan
JordanNealBerg at gmail.com
Thu Jul 10 16:47:02 EDT 2008
Well, that about wraps this up...MRAB was 100% correct, that solution
worked...not sure how I managed to mess it up when I tried it early.
Based on the incoming values of u here is the code with the minimal
number of maskings:
def findit(u):
mask = 0xffffffff
u += 0xe91aaa35
u ^= u >> 16
u = (u + (u << 8)) & mask
u ^= u >> 4
b = (u >> 8) & 0x1ff
a = (u + (u << 2) & mask) >> 19
r = a ^ hash_adjust[b]
return r
Thanks for your help all!
More information about the Python-list
mailing list