aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <herumi@nifty.com>2017-03-10 04:09:29 +0800
committerMITSUNARI Shigeo <herumi@nifty.com>2017-03-10 04:09:29 +0800
commit27ae115c832770bc81d8de0b3f16e802a4f7b4d6 (patch)
treec986ad5c91a6f35c1aaf9ed5bce826bf9b2d5d05
parent26221606e9c96887acd8a38532e95a5aea67de27 (diff)
downloaddexon-mcl-27ae115c832770bc81d8de0b3f16e802a4f7b4d6.tar.gz
dexon-mcl-27ae115c832770bc81d8de0b3f16e802a4f7b4d6.tar.zst
dexon-mcl-27ae115c832770bc81d8de0b3f16e802a4f7b4d6.zip
change type of CurveParam.z
-rw-r--r--include/mcl/bn.hpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/include/mcl/bn.hpp b/include/mcl/bn.hpp
index c2ce74a..8beaf75 100644
--- a/include/mcl/bn.hpp
+++ b/include/mcl/bn.hpp
@@ -20,7 +20,7 @@ struct CurveParam {
v^3 = xi
w^2 = v
*/
- int64_t z;
+ mpz_class z;
int b; // y^2 = x^3 + b
int xi_a; // xi = xi_a + i
bool operator==(const CurveParam& rhs) const { return z == rhs.z && b == rhs.b && xi_a == rhs.xi_a; }
@@ -239,15 +239,12 @@ struct ParamT {
void init(const CurveParam& cp = CurveFp254BNb, fp::Mode mode = fp::FP_AUTO)
{
isCurveFp254BNb = cp == CurveFp254BNb;
- {
- uint64_t t = std::abs(cp.z);
- isNegative = cp.z < 0;
- gmp::setArray(abs_z, &t, 1);
- if (isNegative) {
- z = -abs_z;
- } else {
- z = abs_z;
- }
+ z = cp.z;
+ isNegative = cp.z < 0;
+ if (isNegative) {
+ abs_z = -z;
+ } else {
+ abs_z = z;
}
const int pCoff[] = { 1, 6, 24, 36, 36 };
const int rCoff[] = { 1, 6, 18, 36, 36 };