From 6b2745e0119f7cd06fc586bb84406db2234e87d7 Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Mon, 13 Jun 2016 19:02:48 +0900 Subject: [PATCH] fix Ec::operator<() --- include/mcl/ec.hpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/mcl/ec.hpp b/include/mcl/ec.hpp index ad1c749..6a6c9b7 100644 --- a/include/mcl/ec.hpp +++ b/include/mcl/ec.hpp @@ -693,12 +693,15 @@ public: sub(R, *this, rhs); // QQQ : optimized later return R.isZero(); } + bool operator!=(const EcT& rhs) const { return !operator==(rhs); } bool operator<(const EcT& rhs) const { if (isZero()) { return !rhs.isZero(); } if (rhs.isZero()) return false; + normalize(); + rhs.normalize(); int cmp = Fp::compare(x, rhs.x); if (cmp < 0) return true; if (cmp > 0) return false; @@ -707,7 +710,6 @@ public: bool operator>=(const EcT& rhs) const { return !operator<(rhs); } bool operator>(const EcT& rhs) const { return rhs < *this; } bool operator<=(const EcT& rhs) const { return !operator>(rhs); } - bool operator!=(const EcT& rhs) const { return !operator==(rhs); } private: static inline void mulArray(EcT& z, const EcT& x, const fp::Unit *y, size_t yn, bool isNegative) {