aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-08-27 16:19:58 +0000
committerlloyd <[email protected]>2008-08-27 16:19:58 +0000
commit6805246a8c9bd56e6f6ed106dbaf164625ced3e5 (patch)
tree14f3eb4537d4fa69ecea68129151fb46fc164ee8
parentabe4d72b970a6f111cd69f24fc647aa891150c81 (diff)
Use -BigInt(1) instead of BigInt("-1") to avoid the parsing overhead.
Instead just call the u64bit constructor and invert using the BigInt operator.
-rw-r--r--src/ressol.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ressol.cpp b/src/ressol.cpp
index ab4ad7876..0cd2b988a 100644
--- a/src/ressol.cpp
+++ b/src/ressol.cpp
@@ -27,7 +27,7 @@ BigInt ressol(const BigInt& a, const BigInt& p)
return a;
if(jacobi(a, p) != 1) // not a quadratic residue
- return BigInt("-1");
+ return -BigInt(1);
if(p % 4 == 3)
return power_mod(a, ((p+1) >> 2), p);
@@ -67,7 +67,7 @@ BigInt ressol(const BigInt& a, const BigInt& p)
u32bit t = s;
if(t <= i)
- return BigInt("-1");
+ return -BigInt(1);
c = power_mod(c, BigInt(BigInt::Power2, t-i-1), p);
r = mod_p.multiply(r, c);