secp256k1ScalarCheckOverflow static method

int secp256k1ScalarCheckOverflow(
  1. Secp256k1Scalar a
)

Implementation

static int secp256k1ScalarCheckOverflow(Secp256k1Scalar a) {
  int yes = 0;
  int no = 0;
  no |= (a[3] < Secp256k1Const.secp256k1n3).toInt;
  no |= (a[2] < Secp256k1Const.secp256k1n2).toInt;
  yes |= (a[2] > Secp256k1Const.secp256k1n2).toInt & ~no;
  no |= (a[1] < Secp256k1Const.secp256k1n1).toInt;
  yes |= (a[1] > Secp256k1Const.secp256k1n1).toInt & ~no;
  yes |= (a[0] >= Secp256k1Const.secp256k1n0).toInt & ~no;
  return yes;
}