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