aboutsummaryrefslogtreecommitdiffstats
path: root/chilbert
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-08-26 22:59:55 +0200
committerDavid Robillard <d@drobilla.net>2018-09-29 14:50:34 +0200
commita115beb0d3fedbe3d286ad1ba2dd7af319f7968d (patch)
treecc0a3dc5c6316939020adbc7e9d8a1e1c2813779 /chilbert
parentd5522f58d508827c0db084b2102d73bbafe00255 (diff)
downloadchilbert-a115beb0d3fedbe3d286ad1ba2dd7af319f7968d.tar.gz
chilbert-a115beb0d3fedbe3d286ad1ba2dd7af319f7968d.tar.bz2
chilbert-a115beb0d3fedbe3d286ad1ba2dd7af319f7968d.zip
Use prefix increment/decrement in loops consistently
Diffstat (limited to 'chilbert')
-rw-r--r--chilbert/chilbert.ipp20
-rw-r--r--chilbert/detail/gray_code_rank.hpp2
2 files changed, 11 insertions, 11 deletions
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 <class H, class I>
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 <class H, class I>
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 <class P, class I>
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<intptr_t>(m - 1); i >= 0; i--) {
+ for (intptr_t i = static_cast<intptr_t>(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<intptr_t>(m - 1); i >= 0; i--) {
+ for (intptr_t i = static_cast<intptr_t>(m - 1); i >= 0; --i) {
// Get the Hilbert index bits
ho -= n;
get_bits<H, I>(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<intptr_t>(m - 1); i >= 0; i--) {
+ for (intptr_t i = static_cast<intptr_t>(m - 1); i >= 0; --i) {
// Get the mask and ptrn
size_t b = 0;
extract_mask<I>(ms, n, d, static_cast<size_t>(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 {