secp256k1ScalarGetBitsVar static method
Implementation
static int secp256k1ScalarGetBitsVar(
Secp256k1Scalar a, int offset, int count) {
secp256k1ScalarVerify(a);
_cond(count > 0 && count <= 32, "secp256k1ScalarGetBitsVar");
_cond(offset + count <= 256, "secp256k1ScalarGetBitsVar");
if ((offset + count - 1) >> 6 == offset >> 6) {
return secp256k1ScalarGetBitsLimb32(a, offset, count);
} else {
final n = ((a[offset >> 6] >> (offset & 0x3F)) |
(a[(offset >> 6) + 1] << (64 - (offset & 0x3F)))) &
(0xFFFFFFFF >> (32 - count)).toBigInt;
_cond((offset >> 6) + 1 < 4, "secp256k1ScalarGetBitsVar");
return n.toUnSignedInt32;
}
}