From 25ae3222f8abfd811282d5bd527d4d7020a08789 Mon Sep 17 00:00:00 2001 From: Nathan Hourt Date: Wed, 13 Feb 2019 12:18:12 -0600 Subject: [PATCH] Add missing operator overloads for fc::unsigned_int Turns out that bitshares/bitshares-core#1506 is easier if you can do greater-than comparisons on fc::unsigned_int. Go ahead and add the complement of missing operators. --- include/fc/io/varint.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/fc/io/varint.hpp b/include/fc/io/varint.hpp index 30e42bb..2b58ee2 100644 --- a/include/fc/io/varint.hpp +++ b/include/fc/io/varint.hpp @@ -28,6 +28,14 @@ struct unsigned_int { friend bool operator<( const uint64_t& i, const unsigned_int& v ) { return i < v.value; } friend bool operator<( const unsigned_int& i, const unsigned_int& v ) { return i.value < v.value; } + friend bool operator<=( const unsigned_int& i, const uint64_t& v ) { return i.value <= v; } + friend bool operator<=( const uint64_t& i, const unsigned_int& v ) { return i <= v.value; } + friend bool operator<=( const unsigned_int& i, const unsigned_int& v ) { return i.value <= v.value; } + + friend bool operator>( const unsigned_int& i, const uint64_t& v ) { return i.value > v; } + friend bool operator>( const uint64_t& i, const unsigned_int& v ) { return i > v.value; } + friend bool operator>( const unsigned_int& i, const unsigned_int& v ) { return i.value > v.value; } + friend bool operator>=( const unsigned_int& i, const uint64_t& v ) { return i.value >= v; } friend bool operator>=( const uint64_t& i, const unsigned_int& v ) { return i >= v.value; } friend bool operator>=( const unsigned_int& i, const unsigned_int& v ) { return i.value >= v.value; }