Rotates a 32-bit integer right by a specified number of bits.
int rotr32(int val, int shift) { var modShift = shift & 31; return ((val >> modShift) & mask32) | ((val & mask32) << (32 - modShift)); }