From c43f6a54dceb26942f596f24a5c96c5189f620d4 Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Tue, 8 Jan 2013 16:16:35 -0800 Subject: [PATCH] Optimize uint's operator== and operator!= to not do byte-by-byte compares. --- src/cpp/ripple/uint256.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cpp/ripple/uint256.h b/src/cpp/ripple/uint256.h index 89d718f7c..2937be12a 100644 --- a/src/cpp/ripple/uint256.h +++ b/src/cpp/ripple/uint256.h @@ -206,12 +206,12 @@ public: friend inline bool operator==(const base_uint& a, const base_uint& b) { - return !compare(a, b); + return memcmp(a.pn, b.pn, sizeof(a.pn)) == 0; } friend inline bool operator!=(const base_uint& a, const base_uint& b) { - return !!compare(a, b); + return memcmp(a.pn, b.pn, sizeof(a.pn)) != 0; } std::string GetHex() const