diff --git a/include/mcl/ec.hpp b/include/mcl/ec.hpp index b22ac3c..c829812 100644 --- a/include/mcl/ec.hpp +++ b/include/mcl/ec.hpp @@ -704,8 +704,7 @@ public: } friend inline std::ostream& operator<<(std::ostream& os, const EcT& self) { - int ioMode = fp::detectIoMode(Fp::BaseFp::getIoMode(), os); - ioMode |= ioMode_; + int ioMode = fp::detectIoMode(getIoMode(), os); return os << self.getStr(ioMode); } std::istream& readStream(std::istream& is, int ioMode) @@ -761,8 +760,7 @@ public: } friend inline std::istream& operator>>(std::istream& is, EcT& self) { - int ioMode = fp::detectIoMode(Fp::BaseFp::getIoMode(), os); - ioMode |= ioMode_; + int ioMode = fp::detectIoMode(getIoMode(), is); return self.readStream(is, ioMode); } void setStr(const std::string& str, int ioMode = 0) @@ -787,6 +785,7 @@ public: if (ioMode & 0xff) throw cybozu::Exception("EcT:setIoMode:use Fp::setIomode") << ioMode; ioMode_ = ioMode; } + static inline int getIoMode() { return Fp::getIoMode() | ioMode_; } static inline void getWeierstrass(Fp& yy, const Fp& x) { Fp t;