secp256k1ScalarGetBitsLimb32 static method

int secp256k1ScalarGetBitsLimb32(
  1. Secp256k1Scalar a,
  2. int offset,
  3. int count
)

Implementation

static int secp256k1ScalarGetBitsLimb32(
  Secp256k1Scalar a,
  int offset,
  int count,
) {
  secp256k1ScalarVerify(a);
  _cond(count > 0 && count <= 32, "secp256k1ScalarGetBitsLimb32");
  _cond(
    (offset + count - 1) >> 6 == offset >> 6,
    "secp256k1ScalarGetBitsLimb32",
  );
  final n =
      (a[offset >> 6] >> (offset & 0x3F)) &
      (0xFFFFFFFF >> (32 - count)).toBigInt;
  return n.toU32;
}