From 1dc3dbdf5989a8f1ccb97e74ac30758e79b3a8f2 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 16 Sep 2022 19:43:21 -0400 Subject: Use "auto" to avoid repeating types --- .clang-tidy | 1 - include/chilbert/chilbert.ipp | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index d4f85ba..b47495c 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -6,7 +6,6 @@ Checks: > -*-named-parameter, -*-no-malloc, -*-non-private-member-variables-in-classes, - -*-use-auto, -altera-*, -bugprone-easily-swappable-parameters, -cert-oop54-cpp, diff --git a/include/chilbert/chilbert.ipp b/include/chilbert/chilbert.ipp index 0b6587a..db75a62 100644 --- a/include/chilbert/chilbert.ipp +++ b/include/chilbert/chilbert.ipp @@ -222,7 +222,7 @@ coords_to_index(const P& 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 (auto i = static_cast(m - 1); i >= 0; --i) { if (ds) { ds[i] = d; } @@ -270,7 +270,7 @@ index_to_coords(P& p, const size_t m, const size_t n, const H& h, I&& scratch) // 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 (auto i = static_cast(m - 1); i >= 0; --i) { // Get the Hilbert index bits ho -= n; get_bits(h, n, ho, w); @@ -322,7 +322,7 @@ coords_to_compact_index(const P& p, // If we could avoid allocation altogether (ie: have a // fixed buffer allocated on the stack) then this increases // speed by a bit (4% when n=4, m=20) - size_t* const ds = new size_t[m]; + auto* const ds = new size_t[m]; if (mn > SmallBitVec::bits_per_rack) { DynamicBitVec h(mn); @@ -382,7 +382,7 @@ compact_index_to_coords(P& p, // Work from MSB to LSB size_t d = D0; - for (intptr_t i = static_cast(m - 1); i >= 0; --i) { + for (auto 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); -- cgit v1.2.1