public static void reduce23(int[] z) { int z16 = z[16]; int c = Nat.addWordTo(16, z16 >>> 9, z) + (z16 & P16); if (c > P16 || (c == P16 && Nat.eq(16, z, P))) { c += Nat.inc(16, z); c &= P16; } z[16] = c; }
public static void twice(int[] x, int[] z) { int c = Nat.shiftUpBit(5, x, 0, z); if (c != 0 || (z[4] == P4 && Nat160.gte(z, P))) { Nat.addWordTo(5, PInv, z); } } }
public static void reduce27(int x, int[] z) { // assert x >>> 26 == 0; int z7 = z[7]; int c = (x << 1 | z7 >>> 31); z7 &= P7; z7 += Nat.addWordTo(7, c * PInv, z); z[7] = z7; if (Nat256.gte(z, P)) { subPFrom(z); } }
public static void add(int[] x, int[] y, int[] z) { int c = Nat160.add(x, y, z); if (c != 0 || (z[4] == P4 && Nat160.gte(z, P))) { Nat.addWordTo(5, PInv, z); } }
public static void addOne(int[] x, int[] z) { int c = Nat.inc(5, x, z); if (c != 0 || (z[4] == P4 && Nat160.gte(z, P))) { Nat.addWordTo(5, PInv, z); } }
public static void reduce32(int x, int[] z) { if ((x != 0 && Nat160.mulWordsAdd(PInv, x, z, 0) != 0) || (z[4] == P4 && Nat160.gte(z, P))) { Nat.addWordTo(5, PInv, z); } }
public static void reduce23(int[] z) { int z16 = z[16]; int c = Nat.addWordTo(16, z16 >>> 9, z) + (z16 & P16); if (c > P16 || (c == P16 && Nat.eq(16, z, P))) { c += Nat.inc(16, z); c &= P16; } z[16] = c; }
public static void reduce27(int x, int[] z) { // assert x >>> 26 == 0; int z7 = z[7]; int c = (x << 1 | z7 >>> 31); z7 &= P7; z7 += Nat.addWordTo(7, c * PInv, z); z[7] = z7; if (Nat256.gte(z, P)) { subPFrom(z); } }
public static void reduce(int[] xx, int[] z) { // assert xx[15] >>> 30 == 0; int xx07 = xx[7]; Nat.shiftUpBit(8, xx, 8, xx07, z, 0); int c = Nat256.mulByWordAddTo(PInv, xx, z) << 1; int z7 = z[7]; c += (z7 >>> 31) - (xx07 >>> 31); z7 &= P7; z7 += Nat.addWordTo(7, c * PInv, z); z[7] = z7; if (Nat256.gte(z, P)) { subPFrom(z); } }
public static void reduce(int[] xx, int[] z) { // assert xx[15] >>> 30 == 0; int xx07 = xx[7]; Nat.shiftUpBit(8, xx, 8, xx07, z, 0); int c = Nat256.mulByWordAddTo(PInv, xx, z) << 1; int z7 = z[7]; c += (z7 >>> 31) - (xx07 >>> 31); z7 &= P7; z7 += Nat.addWordTo(7, c * PInv, z); z[7] = z7; if (Nat256.gte(z, P)) { subPFrom(z); } }