From b12b02289d552422bc2fc5ce95623ee573798ea8 Mon Sep 17 00:00:00 2001 From: Ethan Slattery Date: Tue, 21 Sep 2021 12:31:34 -0700 Subject: [PATCH] cleanup bit_reverse --- include/bitpacker/bit.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/bitpacker/bit.hpp b/include/bitpacker/bit.hpp index 6d6dc96..f109d92 100644 --- a/include/bitpacker/bit.hpp +++ b/include/bitpacker/bit.hpp @@ -158,12 +158,12 @@ namespace bitpacker { /// reverses the bits in the value `val`. template - constexpr auto reverse_bits(std::remove_cv_t val) noexcept { - using val_type = std::remove_reference_t>; - static_assert(std::is_integral::value, "bitpacker::reverse_bits: val needs to be an integral type"); - using underlying_type = unsigned_type; - val_type retval = val; - return reverse_bits(static_cast(retval)) >> (sizeof(underlying_type) * ByteSize - BitSize); + constexpr auto reverse_bits(const typename std::remove_cv::type>::type val) noexcept { + using arg_type = typename std::remove_cv::type>::type; + using underlying_type = unsigned_type; + static_assert(std::is_integral::value, "bitpacker::reverse_bits: val needs to be an integral type"); + return reverse_bits(static_cast(val)) >> (sizeof(underlying_type) * ByteSize - BitSize); + } constexpr uint8_t byte_swap(const std::uint8_t v) { return v;