change type of CurveParam.z

dev
MITSUNARI Shigeo 8 years ago
parent 26221606e9
commit 27ae115c83
  1. 17
      include/mcl/bn.hpp

@ -20,7 +20,7 @@ struct CurveParam {
v^3 = xi v^3 = xi
w^2 = v w^2 = v
*/ */
int64_t z; mpz_class z;
int b; // y^2 = x^3 + b int b; // y^2 = x^3 + b
int xi_a; // xi = xi_a + i 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; } 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) void init(const CurveParam& cp = CurveFp254BNb, fp::Mode mode = fp::FP_AUTO)
{ {
isCurveFp254BNb = cp == CurveFp254BNb; isCurveFp254BNb = cp == CurveFp254BNb;
{ z = cp.z;
uint64_t t = std::abs(cp.z); isNegative = cp.z < 0;
isNegative = cp.z < 0; if (isNegative) {
gmp::setArray(abs_z, &t, 1); abs_z = -z;
if (isNegative) { } else {
z = -abs_z; abs_z = z;
} else {
z = abs_z;
}
} }
const int pCoff[] = { 1, 6, 24, 36, 36 }; const int pCoff[] = { 1, 6, 24, 36, 36 };
const int rCoff[] = { 1, 6, 18, 36, 36 }; const int rCoff[] = { 1, 6, 18, 36, 36 };

Loading…
Cancel
Save