PHP supports only signed integers and does not have unsigned right shift operation (>>>). As a result this implementation may produce different results than other murmur3 implementations. If I replace all >> operations with a function that performs unsigned right shift, then the results are back to normal.
One of the implementations for the shift may be found on StackOverflow, I copy it here for convenience:
PHP supports only signed integers and does not have unsigned right shift operation (>>>). As a result this implementation may produce different results than other murmur3 implementations. If I replace all >> operations with a function that performs unsigned right shift, then the results are back to normal.
One of the implementations for the shift may be found on StackOverflow, I copy it here for convenience:
function uRShift($a, $b) { if($b == 0) return $a; return ($a >> $b) & ~(1<<(8*PHP_INT_SIZE-1)>>($b-1)); }
Thanks.