[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
- [lmi-commits] [lmi] master updated (a3a0a42 -> b7c7ce5), Greg Chicares, 2018/02/12
- [lmi-commits] [lmi] master 4f4b26f 2/7: Write inequality comparisons in number-line order,
Greg Chicares <=
- [lmi-commits] [lmi] master 66ef509 4/7: Rename a function for terseness, Greg Chicares, 2018/02/12
- [lmi-commits] [lmi] master e49df2c 5/7: Alphabetize unit-test functions, Greg Chicares, 2018/02/12
- [lmi-commits] [lmi] master 26cb882 6/7: Reorder a function's arguments, Greg Chicares, 2018/02/12
- [lmi-commits] [lmi] master 5deba0f 1/7: Optionally write uncompressed PDF files, Greg Chicares, 2018/02/12
- [lmi-commits] [lmi] master b7c7ce5 7/7: Augment unit tests, Greg Chicares, 2018/02/12
- [lmi-commits] [lmi] master aef4bd7 3/7: Write whitespace before and after binary operators, Greg Chicares, 2018/02/12