rename isYodd to isOdd

dev
MITSUNARI Shigeo 10 years ago
parent b3619c63b0
commit d45ef0da94
  1. 6
      include/mcl/ec.hpp
  2. 2
      include/mcl/fp.hpp
  3. 4
      test/ec_test.cpp

@ -406,7 +406,7 @@ public:
self.normalize(); self.normalize();
os << self.x.toStr(16) << '_'; os << self.x.toStr(16) << '_';
if (compressedExpression_) { if (compressedExpression_) {
return os << Fp::isYodd(self.y); return os << Fp::isOdd(self.y);
} else { } else {
return os << self.y.toStr(16); return os << self.y.toStr(16);
} }
@ -468,7 +468,7 @@ public:
} }
x.appendToBitVec(bv); x.appendToBitVec(bv);
if (compressedExpression_) { if (compressedExpression_) {
bv.append(Fp::isYodd(y), 1); bv.append(Fp::isOdd(y), 1);
} else { } else {
y.appendToBitVec(bv); y.appendToBitVec(bv);
} }
@ -519,7 +519,7 @@ public:
t *= x; t *= x;
t += b_; t += b_;
Fp::squareRoot(y, t); Fp::squareRoot(y, t);
if (Fp::isYodd(y) ^ isYodd) { if (Fp::isOdd(y) ^ isYodd) {
Fp::neg(y, y); Fp::neg(y, y);
} }
} }

@ -130,7 +130,7 @@ public:
{ {
Gmp::toStr(pstr, op_.mp); Gmp::toStr(pstr, op_.mp);
} }
static inline bool isYodd(const FpT& x) static inline bool isOdd(const FpT& x)
{ {
fp::Block b; fp::Block b;
x.getBlock(b); x.getBlock(b);

@ -134,12 +134,12 @@ struct Test {
{ {
Fp x(para.gx); Fp x(para.gx);
Fp y(para.gy); Fp y(para.gy);
bool odd = Fp::isYodd(y); bool odd = Fp::isOdd(y);
Fp yy; Fp yy;
Ec::getYfromX(yy, x, odd); Ec::getYfromX(yy, x, odd);
CYBOZU_TEST_EQUAL(yy, y); CYBOZU_TEST_EQUAL(yy, y);
Fp::neg(y, y); Fp::neg(y, y);
odd = Fp::isYodd(y); odd = Fp::isOdd(y);
yy.clear(); yy.clear();
Ec::getYfromX(yy, x, odd); Ec::getYfromX(yy, x, odd);
CYBOZU_TEST_EQUAL(yy, y); CYBOZU_TEST_EQUAL(yy, y);

Loading…
Cancel
Save