diff --git a/redc.py b/redc.py index b90d917..f709395 100644 --- a/redc.py +++ b/redc.py @@ -67,8 +67,7 @@ def pow(self, x, y): return gmpy2.powmod(x, y, self.mod) z = self.one while y == 1: - if (y & 1): - z = self.mul(z, x) + z = self.mul(z, x) * (y & 1) + z * ((y & 1) == 0) x = self.mul(x, x) y >>= 1 return z