rotl32 function

int rotl32(
  1. int val,
  2. int shift
)

Rotates a 32-bit integer left by a specified number of bits.

Implementation

int rotl32(int val, int shift) {
  final modShift = shift & 31;
  return ((val << modShift) & mask32) | ((val & mask32) >> (32 - modShift));
}