From 498aba272f0f3b4a2fcc5772b0354870029fa12b Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Thu, 12 Apr 2012 23:22:13 -0700 Subject: [PATCH] Fixes and cleanups. --- src/Amount.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Amount.cpp b/src/Amount.cpp index 9e78907a7..16498f1d5 100644 --- a/src/Amount.cpp +++ b/src/Amount.cpp @@ -15,8 +15,8 @@ void STAmount::canonicalize() { if (value == 0) { - offset=0; - value=0; + offset = 0; + value = 0; return; } while (value < cMinValue) @@ -116,7 +116,8 @@ bool STAmount::operator!=(const STAmount& a) const bool STAmount::operator<(const STAmount& a) const { - if (value == 0) return false; + if (a.value == 0) return false; + if (value == 0) return true; if (offset < a.offset) return true; if (a.offset < offset) return false; return value < a.value; @@ -124,7 +125,8 @@ bool STAmount::operator<(const STAmount& a) const bool STAmount::operator>(const STAmount& a) const { - if (value == 0) return a.value != 0; + if (value == 0) return false; + if (a.value == 0) return true; if (offset > a.offset) return true; if (a.offset > offset) return false; return value > a.value; @@ -132,7 +134,8 @@ bool STAmount::operator>(const STAmount& a) const bool STAmount::operator<=(const STAmount& a) const { - if (value == 0) return a.value == 0; + if (value == 0) return true; + if (a.value == 0) return false; if (offset < a.offset) return true; if (a.offset < offset) return false; return value <= a.value; @@ -140,7 +143,8 @@ bool STAmount::operator<=(const STAmount& a) const bool STAmount::operator>=(const STAmount& a) const { - if (value == 0) return true; + if (a.value == 0) return true; + if (value == 0) return false; if (offset > a.offset) return true; if (a.offset > offset) return false; return value >= a.value;