From 7d005b8d98b5547e5847895140d52a2707545ed5 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 22 Jun 2010 01:25:03 -0400 Subject: Balances and sequences can be compared to amounts --- src/value.cc | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'src/value.cc') diff --git a/src/value.cc b/src/value.cc index 99837832..c34792b2 100644 --- a/src/value.cc +++ b/src/value.cc @@ -901,13 +901,10 @@ bool value_t::is_less_than(const value_t& val) const switch (val.type()) { case INTEGER: case AMOUNT: { - if (val.is_nonzero()) - break; - bool no_amounts = true; foreach (const balance_t::amounts_map::value_type& pair, as_balance().amounts) { - if (pair.second >= 0L) + if (pair.second >= val) return false; no_amounts = false; } @@ -927,12 +924,9 @@ bool value_t::is_less_than(const value_t& val) const switch (val.type()) { case INTEGER: case AMOUNT: { - if (val.is_nonzero()) - break; - bool no_amounts = true; foreach (const value_t& value, as_sequence()) { - if (value >= 0L) + if (value >= val) return false; no_amounts = false; } @@ -1023,13 +1017,10 @@ bool value_t::is_greater_than(const value_t& val) const switch (val.type()) { case INTEGER: case AMOUNT: { - if (val.is_nonzero()) - break; - bool no_amounts = true; foreach (const balance_t::amounts_map::value_type& pair, as_balance().amounts) { - if (pair.second <= 0L) + if (pair.second <= val) return false; no_amounts = false; } @@ -1049,12 +1040,9 @@ bool value_t::is_greater_than(const value_t& val) const switch (val.type()) { case INTEGER: case AMOUNT: { - if (val.is_nonzero()) - break; - bool no_amounts = true; foreach (const value_t& value, as_sequence()) { - if (value <= 0L) + if (value <= val) return false; no_amounts = false; } -- cgit v1.2.3