BigInteger: speed up powMod() method

This commit is contained in:
terrafrost 2023-06-25 00:37:37 -05:00
parent 862b9662a2
commit bc8e0ed636

View File

@ -644,6 +644,11 @@ abstract class Engine implements \JsonSerializable
return $this->normalize($temp->powModInner($e, $n));
}
if ($this->compare($n) > 0) {
list(, $temp) = $this->divide($n);
return $temp->powModInner($e, $n);
}
return $this->powModInner($e, $n);
}