diff --git a/.gitignore b/.gitignore index 04e66d7..183f3ce 100644 --- a/.gitignore +++ b/.gitignore @@ -33,6 +33,8 @@ /.idea/ /cmake-*/ +/build/ /build-*/ -/test/catch.hpp +/_codeql_build_dir/ +_codeql_detected_source_root diff --git a/include/libparenth.hpp b/include/libparenth.hpp index f86b814..64c9d49 100644 --- a/include/libparenth.hpp +++ b/include/libparenth.hpp @@ -329,13 +329,14 @@ class Parenther { auto bsums = std::move(q_.top()); q_.pop(); + auto has_top = bsums.curr_sums.count() > 0; auto top_idx = bsums.curr_sums.find_last(); auto next_idx = top_idx + 1; if (next_idx < sums_.size()) { // Augmentation. bsums.lsc = bsums.lsc * parenther_.dims_[sums_[next_idx]]; - if (top_idx < 0) { + if (!has_top) { bsums.lsc = bsums.lsc * Dim(2l); } bsums.curr_sums.set(next_idx); @@ -345,7 +346,7 @@ class Parenther { } // Shift. - if (top_idx >= 0) { + if (has_top) { const auto& top_dim = parenther_.dims_[sums_[top_idx]]; assert(bsums.lsc % top_dim == 0); bsums.lsc = bsums.lsc / top_dim; diff --git a/test/matrixchain.cpp b/test/matrixchain.cpp index 642517b..6d41231 100644 --- a/test/matrixchain.cpp +++ b/test/matrixchain.cpp @@ -17,8 +17,8 @@ // Disable Catch2's range detection for fbitset by providing stream insertion operator namespace fbitset { - template - inline std::ostream& operator<<(std::ostream& os, const Fbitset& fs) { + template + inline std::ostream& operator<<(std::ostream& os, const Fbitset& fs) { os << "Fbitset<" << N << ">{count=" << fs.count() << "}"; return os; }