add StrToMode

dev
MITSUNARI Shigeo 9 years ago
parent eacbc51b89
commit d596d7f49a
  1. 18
      include/mcl/op.hpp

@ -70,6 +70,24 @@ static inline const char *ModeToStr(Mode mode)
}
}
static inline Mode StrToMode(const std::string& s)
{
static const struct {
const char *s;
Mode mode;
} tbl[] = {
{ "auto", FP_AUTO },
{ "gmp", FP_GMP },
{ "llvm", FP_LLVM },
{ "llvm_mont", FP_LLVM_MONT },
{ "xbyak", FP_XBYAK },
};
for (size_t i = 0; i < CYBOZU_NUM_OF_ARRAY(tbl); i++) {
if (s == tbl[i].s) return tbl[i].mode;
}
throw cybozu::Exception("StrToMode") << s;
}
struct Op {
mpz_class mp;
mcl::SquareRoot sq;

Loading…
Cancel
Save