secp256k1Rotr32 static method

int secp256k1Rotr32(
  1. int x,
  2. int by
)

Implementation

static int secp256k1Rotr32(int x, int by) {
  /// Reduce rotation amount to avoid UB when shifting.
  const int mask = 8 * 4 - 1;

  /// Turned into a rot instruction by GCC and clang.
  return ((x >> (by & mask)).toUnSigned32 |
          (x << ((-by) & mask)).toUnSigned32)
      .toUnSigned32;
}