diff options
Diffstat (limited to 'crypto/src/math')
-rw-r--r-- | crypto/src/math/raw/Mod.cs | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/crypto/src/math/raw/Mod.cs b/crypto/src/math/raw/Mod.cs index 1a1524c11..a1eeaa9b7 100644 --- a/crypto/src/math/raw/Mod.cs +++ b/crypto/src/math/raw/Mod.cs @@ -278,21 +278,19 @@ namespace Org.BouncyCastle.Math.Raw Debug.Assert((u * f0 + v * g0) == f << i); Debug.Assert((q * f0 + r * g0) == g << i); - int p = -(g & 1); - int s = eta >> 31; + int c1 = eta >> 31; + int c2 = -(g & 1); - int c1 = p & s; - int c2 = p & ~s; + int x = (f ^ c1) - c1; + int y = (u ^ c1) - c1; + int z = (v ^ c1) - c1; - eta = (eta ^ c1) - (c1 + 1); - - g += f & c2; - q += u & c2; - r += v & c2; + g += x & c2; + q += y & c2; + r += z & c2; - g -= f & c1; - q -= u & c1; - r -= v & c1; + c1 &= c2; + eta = (eta ^ c1) - (c1 + 1); f += g & c1; u += q & c1; |