lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 4f4b26f 2/7: Write inequality comparisons in


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 4f4b26f 2/7: Write inequality comparisons in number-line order
Date: Mon, 12 Feb 2018 07:15:10 -0500 (EST)

branch: master
commit 4f4b26f3a160c30e639a8e404a8346f46ff1a01c
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Write inequality comparisons in number-line order
---
 miscellany.cpp | 4 ++--
 miscellany.hpp | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/miscellany.cpp b/miscellany.cpp
index a300adb..d8c8cd1 100644
--- a/miscellany.cpp
+++ b/miscellany.cpp
@@ -199,7 +199,7 @@ int get_needed_pages_count
     // The caller must check for this precondition because this function is too
     // low-level to be able to handle it correctly, e.g. it can't even use the
     // appropriate error message.
-    LMI_ASSERT(rows_per_page >= rows_per_group);
+    LMI_ASSERT(rows_per_group <= rows_per_page);
 
     // Each group actually takes rows_per_group+1 rows because of the
     // separator row between groups, hence the second +1, but there is no
@@ -216,7 +216,7 @@ int get_needed_pages_count
     // The last page may not be needed if all the rows on it can fit into the
     // remaining space, too small for a full group, but perhaps sufficient for
     // these rows, in the last by one page.
-    if (num_pages > 1)
+    if(1 < num_pages)
         {
         auto const rows_on_last_page = total_rows - (num_pages - 
1)*used_per_page;
         auto const free_rows = rows_per_page - groups_per_page*(rows_per_group 
+ 1);
diff --git a/miscellany.hpp b/miscellany.hpp
index 722683f..a057a8a 100644
--- a/miscellany.hpp
+++ b/miscellany.hpp
@@ -216,7 +216,7 @@ inline void stifle_warning_for_unused_value(T const& t)
 /// Compute the number of pages needed to display the given number of non-blank
 /// rows in groups of the specified size separated by blank rows.
 ///
-/// Preconditions: total_rows > 0 && rows_per_page >= rows_per_group > 0
+/// Preconditions: 0 < total_rows && 0 < rows_per_group <= rows_per_page
 
 int LMI_SO get_needed_pages_count
     (int total_rows



reply via email to

[Prev in Thread] Current Thread [Next in Thread]