1 package com.hurlant.math
\r
3 use namespace bi_internal;
\r
6 * Modular reduction using "classic" algorithm
\r
8 internal class ClassicReduction implements IReduction
\r
10 private var m:BigInteger;
\r
11 public function ClassicReduction(m:BigInteger) {
\r
14 public function convert(x:BigInteger):BigInteger {
\r
15 if (x.s<0 || x.compareTo(m)>=0) {
\r
20 public function revert(x:BigInteger):BigInteger {
\r
23 public function reduce(x:BigInteger):void {
\r
24 x.divRemTo(m, null,x);
\r
26 public function mulTo(x:BigInteger, y:BigInteger, r:BigInteger):void {
\r
30 public function sqrTo(x:BigInteger, r:BigInteger):void {
\r