diff options
author | Thomas Habets <thomas@habets.se> | 2019-12-21 19:22:20 +0000 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2020-01-06 15:38:02 -0800 |
commit | c7f95a96b93baccb6c92795fc1d261789b4f21a6 (patch) | |
tree | 0510426f791fc86ceeda7f2b3bdbec7d943ff29f | |
parent | 2c2c65656197596b8455ae0813c3c80cea023406 (diff) |
gr-blocks/packed&unpacked: More constexpr
-rw-r--r-- | gr-blocks/include/gnuradio/blocks/log2_const.h | 24 | ||||
-rw-r--r-- | gr-blocks/lib/packed_to_unpacked_impl.h | 4 | ||||
-rw-r--r-- | gr-blocks/lib/unpacked_to_packed_impl.h | 2 |
3 files changed, 15 insertions, 15 deletions
diff --git a/gr-blocks/include/gnuradio/blocks/log2_const.h b/gr-blocks/include/gnuradio/blocks/log2_const.h index 7fc04a94f3..4f352fb3c1 100644 --- a/gr-blocks/include/gnuradio/blocks/log2_const.h +++ b/gr-blocks/include/gnuradio/blocks/log2_const.h @@ -34,64 +34,64 @@ namespace gr { namespace blocks { template <unsigned int k> -static inline int log2_const() +static inline constexpr int log2_const() { assert(0); return 0; } template <> -inline int log2_const<1>() +inline constexpr int log2_const<1>() { return 0; } template <> -inline int log2_const<2>() +inline constexpr int log2_const<2>() { return 1; } template <> -inline int log2_const<4>() +inline constexpr int log2_const<4>() { return 2; } template <> -inline int log2_const<8>() +inline constexpr int log2_const<8>() { return 3; } template <> -inline int log2_const<16>() +inline constexpr int log2_const<16>() { return 4; } template <> -inline int log2_const<32>() +inline constexpr int log2_const<32>() { return 5; } template <> -inline int log2_const<64>() +inline constexpr int log2_const<64>() { return 6; } template <> -inline int log2_const<128>() +inline constexpr int log2_const<128>() { return 7; } template <> -inline int log2_const<256>() +inline constexpr int log2_const<256>() { return 8; } template <> -inline int log2_const<512>() +inline constexpr int log2_const<512>() { return 9; } template <> -inline int log2_const<1024>() +inline constexpr int log2_const<1024>() { return 10; } diff --git a/gr-blocks/lib/packed_to_unpacked_impl.h b/gr-blocks/lib/packed_to_unpacked_impl.h index e49f02fa0e..26667680d1 100644 --- a/gr-blocks/lib/packed_to_unpacked_impl.h +++ b/gr-blocks/lib/packed_to_unpacked_impl.h @@ -37,8 +37,8 @@ private: const unsigned int d_bits_per_chunk; const endianness_t d_endianness; unsigned int d_index; - const unsigned int d_bits_per_type = sizeof(T) * 8; - const unsigned int d_log2_l_type = log2_const<sizeof(T) * 8>(); + static constexpr unsigned int d_bits_per_type = sizeof(T) * 8; + static constexpr unsigned int d_log2_l_type = log2_const<sizeof(T) * 8>(); unsigned int get_bit_le(const T* in_vector, unsigned int bit_addr); unsigned int get_bit_be(const T* in_vector, unsigned int bit_addr); diff --git a/gr-blocks/lib/unpacked_to_packed_impl.h b/gr-blocks/lib/unpacked_to_packed_impl.h index 50398aee8c..978dc606f9 100644 --- a/gr-blocks/lib/unpacked_to_packed_impl.h +++ b/gr-blocks/lib/unpacked_to_packed_impl.h @@ -36,7 +36,7 @@ private: const unsigned int d_bits_per_chunk; const endianness_t d_endianness; unsigned int d_index; - const unsigned int d_bits_per_type = sizeof(T) * 8; + static constexpr unsigned int d_bits_per_type = sizeof(T) * 8; unsigned int get_bit_be1(const T* in_vector, unsigned int bit_addr, unsigned int bits_per_chunk); |