From 2e4d666eec1a372d4b64c527d6c4945ad98d2b58 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 16 Sep 2022 21:19:57 -0400 Subject: Update clang-format configuration --- include/chilbert/StaticBitVec.hpp | 100 +++++++++++++++++++++++--------------- 1 file changed, 60 insertions(+), 40 deletions(-) (limited to 'include/chilbert/StaticBitVec.hpp') diff --git a/include/chilbert/StaticBitVec.hpp b/include/chilbert/StaticBitVec.hpp index 9aff3ad..1cd59b0 100644 --- a/include/chilbert/StaticBitVec.hpp +++ b/include/chilbert/StaticBitVec.hpp @@ -42,75 +42,95 @@ namespace chilbert { * * @tparam N Number of bits. */ -template +template class StaticBitVec : public detail::MultiBitVec> { public: - using Rack = typename detail::MultiBitVec>::Rack; + using Rack = typename detail::MultiBitVec>::Rack; - using detail::MultiBitVec>::bits_per_rack; + using detail::MultiBitVec>::bits_per_rack; - StaticBitVec() = default; + StaticBitVec() = default; - /// Constructor for compatibility with DynamicBitVec - explicit StaticBitVec(const size_t bits) { assert(bits == size()); } + /// Constructor for compatibility with DynamicBitVec + explicit StaticBitVec(const size_t bits) { assert(bits == size()); } - /// Constructor for compatibility with DynamicBitVec - StaticBitVec(const size_t bits, const Rack value) - : StaticBitVec{bits} - { - m_racks[0] = value; - } + /// Constructor for compatibility with DynamicBitVec + StaticBitVec(const size_t bits, const Rack value) + : StaticBitVec{bits} + { + m_racks[0] = value; + } - /// Return the size in bits - size_t size() const { return N; } + /// Return the size in bits + size_t size() const { return N; } - /// Return a reference to the `index`th rack + /// Return a reference to the `index`th rack #ifndef NDEBUG - const auto& rack(const size_t index) const { return m_racks.at(index); } - auto& rack(const size_t index) { return m_racks.at(index); } + const auto& rack(const size_t index) const + { + return m_racks.at(index); + } + auto& rack(const size_t index) + { + return m_racks.at(index); + } #else - const auto& rack(const size_t index) const { return m_racks[index]; } - auto& rack(const size_t index) { return m_racks[index]; } + const auto& rack(const size_t index) const + { + return m_racks[index]; + } + auto& rack(const size_t index) + { + return m_racks[index]; + } #endif - /// Return a raw pointer to the racks - Rack* data() { return m_racks.data(); } - const Rack* data() const { return m_racks.data(); } - - /// Return the total size of all racks in bytes - static constexpr size_t data_size() { return num_racks() * sizeof(Rack); } - - /// Return the number of racks - static constexpr size_t num_racks() - { - return (std::max(N, size_t(1)) + bits_per_rack - 1) / bits_per_rack; - } + /// Return a raw pointer to the racks + Rack* data() + { + return m_racks.data(); + } + const Rack* data() const + { + return m_racks.data(); + } + + /// Return the total size of all racks in bytes + static constexpr size_t data_size() + { + return num_racks() * sizeof(Rack); + } + + /// Return the number of racks + static constexpr size_t num_racks() + { + return (std::max(N, size_t(1)) + bits_per_rack - 1) / bits_per_rack; + } private: - std::array m_racks{}; + std::array m_racks{}; }; namespace detail { -template -struct is_bitvec> -{ - constexpr static bool value = true; +template +struct is_bitvec> { + constexpr static bool value = true; }; -template +template void gray_code(StaticBitVec& value) { - gray_code(static_cast>&>(value)); + gray_code(static_cast>&>(value)); } -template +template void gray_code_inv(StaticBitVec& value) { - gray_code_inv(static_cast>&>(value)); + gray_code_inv(static_cast>&>(value)); } } // namespace detail -- cgit v1.2.1