secp256k1FeNegate static method

void secp256k1FeNegate(
  1. Secp256k1Fe r,
  2. Secp256k1Fe a,
  3. int m
)

Implementation

static void secp256k1FeNegate(Secp256k1Fe r, Secp256k1Fe a, int m) {
  _cond(m >= 0 && m <= 31, "secp256k1FeNegate");
  // /// For all legal values of m (0..31), the following properties hold:
  _cond(
      Secp256k1Const.mask47 * BigInt.two * (m.toBigInt + BigInt.one) >=
          Secp256k1Const.mask52 * BigInt.two * m.toBigInt,
      "secp256k1FeNegate");
  _cond(
      Secp256k1Const.mask52 * BigInt.two * (m.toBigInt + BigInt.one) >=
          Secp256k1Const.mask52 * BigInt.two * m.toBigInt,
      "secp256k1FeNegate");
  _cond(
      Secp256k1Const.mask48 * BigInt.two * (m.toBigInt + BigInt.one) >=
          Secp256k1Const.mask48 * BigInt.two * m.toBigInt,
      "secp256k1FeNegate");
  r[0] = Secp256k1Const.mask47 * BigInt.two * (m + 1).toBigInt - a[0];
  r[1] = Secp256k1Const.mask52 * BigInt.two * (m + 1).toBigInt - a[1];
  r[2] = Secp256k1Const.mask52 * BigInt.two * (m + 1).toBigInt - a[2];
  r[3] = Secp256k1Const.mask52 * BigInt.two * (m + 1).toBigInt - a[3];
  r[4] = Secp256k1Const.mask48 * BigInt.two * (m + 1).toBigInt - a[4];
}