public void reduce(BigInteger x) { if (x == null) { return; } x.divRemTo(this.m, null, x); }
// xR mod m public BigInteger convert(BigInteger x) { if (x == null) { return null; } BigInteger r = new BigInteger(); x.abs().dlShiftTo(this.m.t, r); r.divRemTo(this.m, null, r); if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) { this.m.subTo(r, r); } return r; }