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/deps/fbitset b/deps/fbitset index 1f1a3db..c3ca474 160000 --- a/deps/fbitset +++ b/deps/fbitset @@ -1 +1 @@ -Subproject commit 1f1a3db3dd86dacbdfc422bed91a1d79f87230e7 +Subproject commit c3ca47404ac195a96f87ccf94ea66b3fc593cff5 diff --git a/include/libparenth.hpp b/include/libparenth.hpp index f86b814..7e6e5e8 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_idx = 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_idx) { 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_idx) { 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; }