diff options
-rw-r--r-- | include/chilbert/detail/gray_code_rank.hpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/include/chilbert/detail/gray_code_rank.hpp b/include/chilbert/detail/gray_code_rank.hpp index b049540..f87fa4b 100644 --- a/include/chilbert/detail/gray_code_rank.hpp +++ b/include/chilbert/detail/gray_code_rank.hpp @@ -88,6 +88,8 @@ gray_code_rank_inv(const I& mask, I& g, I& gi) { + using Rack = typename I::Rack; + assert(mask.size() == n); assert(ptrn.size() == n); assert(r.size() == n); @@ -100,9 +102,9 @@ gray_code_rank_inv(const I& mask, auto m = mask.mask(n - 1); auto ri = r.begin(b - 1); - typename I::Rack gi0 = 0; - typename I::Rack gi1 = 0; - typename I::Rack g0 = 0; + Rack gi0{}; + Rack gi1{}; + Rack g0{}; for (size_t i = 0; i < n; ++i) { if (mask.test(m)) { // Unconstrained bit @@ -117,7 +119,7 @@ gray_code_rank_inv(const I& mask, } --ri; } else { // Constrained bit - g0 = (ptrn.test(m) > 0); + g0 = Rack{ptrn.test(m)}; gi1 = gi0; gi0 = g0 ^ gi1; if (gi0) { |