private static void InversionStep(uint[] p, uint[] u, int uLen, uint[] x, ref int xc) { int len = p.Length; int count = 0; while (u[0] == 0) { Nat.ShiftDownWord(uLen, u, 0); count += 32; } { int zeroes = GetTrailingZeroes(u[0]); if (zeroes > 0) { Nat.ShiftDownBits(uLen, u, zeroes, 0); count += zeroes; } } for (int i = 0; i < count; ++i) { if ((x[0] & 1) != 0) { if (xc < 0) { xc += (int)Nat.AddTo(len, p, x); } else { xc += Nat.SubFrom(len, p, x); } } Debug.Assert(xc == 0 || xc == -1); Nat.ShiftDownBit(len, x, (uint)xc); } }