What about a function like below ?
; u32 hash(u8* P1)
hash:
mov edx, [esp+4]
xor eax, eax
cmp edx, 0
je .f
xor ecx, ecx
..0: mov al, [edx]
add ecx, eax
inc edx
cmp eax, 0
jne .0
mov eax, ecx
xor edx, edx
mov ecx, HASHSIZE
div ecx
mov eax, edx
..f:
ret 4
hash: r=[s+4]; a^=a; r==0#.f; c^=c;
..0: al=[r]; c+=a; ++r; a#.0
a=c; r^=r; c=4019; div c; a=r
..f: ret 4


|