rename TRY_AND_INC

update-fork
MITSUNARI Shigeo 5 years ago
parent bfd0459d2f
commit 54ed316fe1
  1. 6
      include/mcl/bn.hpp
  2. 2
      include/mcl/curve_type.h

@ -527,12 +527,12 @@ struct MapTo {
bool setMapToMode(int mode) bool setMapToMode(int mode)
{ {
if (type_ == STD_ECtype) { if (type_ == STD_ECtype) {
mapToMode_ = MCL_MAP_TO_TRY_AND_INC; mapToMode_ = MCL_MAP_TO_MODE_TRY_AND_INC;
return true; return true;
} }
switch (mode) { switch (mode) {
case MCL_MAP_TO_MODE_ORIGINAL: case MCL_MAP_TO_MODE_ORIGINAL:
case MCL_MAP_TO_TRY_AND_INC: case MCL_MAP_TO_MODE_TRY_AND_INC:
case MCL_MAP_TO_MODE_ETH2: case MCL_MAP_TO_MODE_ETH2:
mapToMode_ = mode; mapToMode_ = mode;
return true; return true;
@ -569,7 +569,7 @@ struct MapTo {
template<class G, class F> template<class G, class F>
bool mapToEc(G& P, const F& t) const bool mapToEc(G& P, const F& t) const
{ {
if (mapToMode_ == MCL_MAP_TO_TRY_AND_INC || mapToMode_ == MCL_MAP_TO_MODE_ETH2) { if (mapToMode_ == MCL_MAP_TO_MODE_TRY_AND_INC || mapToMode_ == MCL_MAP_TO_MODE_ETH2) {
naiveMapTo<G, F>(P, t); naiveMapTo<G, F>(P, t);
} else { } else {
if (!calcBN<G, F>(P, t)) return false; if (!calcBN<G, F>(P, t)) return false;

@ -38,6 +38,6 @@ enum {
enum { enum {
MCL_MAP_TO_MODE_ORIGINAL, // see MapTo::calcBN MCL_MAP_TO_MODE_ORIGINAL, // see MapTo::calcBN
MCL_MAP_TO_TRY_AND_INC, // try-and-incremental-x MCL_MAP_TO_MODE_TRY_AND_INC, // try-and-incremental-x
MCL_MAP_TO_MODE_ETH2 // eth2.0 spec MCL_MAP_TO_MODE_ETH2 // eth2.0 spec
}; };

Loading…
Cancel
Save