From db9028906a0d50ce7c60f9b34c8d203a2c122385 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 3 Feb 2022 13:14:15 +0100 Subject: [PATCH] small optimization. --- libsolutil/LP.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libsolutil/LP.cpp b/libsolutil/LP.cpp index 53103c886..0a2b2f3f7 100644 --- a/libsolutil/LP.cpp +++ b/libsolutil/LP.cpp @@ -514,12 +514,9 @@ bool Constraint::operator<(Constraint const& _other) const return equality < _other.equality; for (size_t i = 0; i < max(data.size(), _other.data.size()); ++i) - { - rational const& a = data.get(i); - rational const& b = _other.data.get(i); - if (a != b) - return a < b; - } + if (rational diff = data.get(i) - _other.data.get(i)) + return diff < 0; + return false; }