From a115beb0d3fedbe3d286ad1ba2dd7af319f7968d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 26 Aug 2018 22:59:55 +0200 Subject: Use prefix increment/decrement in loops consistently --- chilbert/chilbert.ipp | 20 ++++++++++---------- chilbert/detail/gray_code_rank.hpp | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'chilbert') diff --git a/chilbert/chilbert.ipp b/chilbert/chilbert.ipp index c4e8249..a62a258 100644 --- a/chilbert/chilbert.ipp +++ b/chilbert/chilbert.ipp @@ -82,7 +82,7 @@ template inline void get_bits(const H& h, const size_t n, const size_t i, I& w) { - for (size_t j = 0; j < n; j++) { + for (size_t j = 0; j < n; ++j) { set_bit(w, j, test_bit(h, i + j)); } } @@ -98,7 +98,7 @@ template inline void set_bits(H& h, const size_t n, const size_t i, const I& w) { - for (size_t j = 0; j < n; j++) { + for (size_t j = 0; j < n; ++j) { set_bit(h, i + j, test_bit(w, j)); } } @@ -130,7 +130,7 @@ template inline void set_location(P* const p, const size_t n, const size_t i, const I& l) { - for (size_t j = 0; j < n; j++) { + for (size_t j = 0; j < n; ++j) { set_bit(p[j], i, test_bit(l, j)); } } @@ -221,7 +221,7 @@ coords_to_index(const P* const p, // Work from MSB to LSB size_t d = D0; size_t ho = m * n; - for (intptr_t i = static_cast(m - 1); i >= 0; i--) { + for (intptr_t i = static_cast(m - 1); i >= 0; --i) { if (ds) { ds[i] = d; } @@ -262,14 +262,14 @@ index_to_coords(P* p, const size_t m, const size_t n, const H& h, I&& scratch) // Initialize e.reset(); l.reset(); - for (size_t j = 0; j < n; j++) { + for (size_t j = 0; j < n; ++j) { reset_bits(p[j]); } // Work from MSB to LSB size_t d = D0; size_t ho = m * n; - for (intptr_t i = static_cast(m - 1); i >= 0; i--) { + for (intptr_t i = static_cast(m - 1); i >= 0; --i) { // Get the Hilbert index bits ho -= n; get_bits(h, n, ho, w); @@ -305,7 +305,7 @@ coords_to_compact_index(const P* const p, // Get total precision and max precision if not supplied if (M == 0 || m == 0) { M = m = 0; - for (size_t i = 0; i < n; i++) { + for (size_t i = 0; i < n; ++i) { assert(num_bits(p[i]) >= ms[i]); if (ms[i] > m) { m = ms[i]; @@ -360,7 +360,7 @@ compact_index_to_coords(P* const p, // if not supplied if (M == 0 || m == 0) { M = m = 0; - for (size_t i = 0; i < n; i++) { + for (size_t i = 0; i < n; ++i) { if (ms[i] > m) { m = ms[i]; } @@ -374,14 +374,14 @@ compact_index_to_coords(P* const p, // Initialize e.reset(); l.reset(); - for (size_t j = 0; j < n; j++) { + for (size_t j = 0; j < n; ++j) { reset_bits(p[j]); } // Work from MSB to LSB size_t d = D0; - for (intptr_t i = static_cast(m - 1); i >= 0; i--) { + for (intptr_t i = static_cast(m - 1); i >= 0; --i) { // Get the mask and ptrn size_t b = 0; extract_mask(ms, n, d, static_cast(i), mask, b); diff --git a/chilbert/detail/gray_code_rank.hpp b/chilbert/detail/gray_code_rank.hpp index 815519e..b17f193 100644 --- a/chilbert/detail/gray_code_rank.hpp +++ b/chilbert/detail/gray_code_rank.hpp @@ -48,7 +48,7 @@ compact_index(const size_t* const ms, auto hcm = hc.mask(0); // Run through the levels of precision - for (size_t i = 0; i < m; i++) { + for (size_t i = 0; i < m; ++i) { // Run through the dimensions size_t j = ds[i]; do { -- cgit v1.2.1