aboutsummaryrefslogtreecommitdiff
path: root/bitfield.h
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2023-08-08 22:18:28 +0200
committerJohannes Stoelp <johannes.stoelp@gmail.com>2023-08-08 22:18:28 +0200
commit851d4fb9db087eeb183f1c1cb5d96829a32e690b (patch)
treeb7bcefc108ed310b6568cb10f728233833209ccc /bitfield.h
parent005cd3b630fcf0f3870f426a0db5e54400a59ef9 (diff)
downloadcpp-utils-851d4fb9db087eeb183f1c1cb5d96829a32e690b.tar.gz
cpp-utils-851d4fb9db087eeb183f1c1cb5d96829a32e690b.zip
add clang-tidy and fix lints
Diffstat (limited to 'bitfield.h')
-rw-r--r--bitfield.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/bitfield.h b/bitfield.h
index 833a722..9aafaf8 100644
--- a/bitfield.h
+++ b/bitfield.h
@@ -10,7 +10,7 @@ namespace impl {
* Constant check for supported underlying BITFILED types.
*/
template <typename ValueType>
-static constexpr bool is_bitfield_type =
+static constexpr bool is_bitfield_type_v =
std::is_integral<ValueType>::value && std::is_unsigned<ValueType>::value &&
!std::is_same<ValueType, bool>::value;
@@ -107,7 +107,7 @@ struct const_field_ref {
*/
template <typename ValueType = std::uint32_t>
struct bitfield {
- static_assert(impl::is_bitfield_type<ValueType>,
+ static_assert(impl::is_bitfield_type_v<ValueType>,
"bitfield instantiated with incorrect type");
constexpr explicit bitfield(ValueType val) : m_val{val} {}
@@ -177,11 +177,11 @@ struct bitfield {
// -- TESTS --------------------------------------------------------------------
-static_assert(impl::is_bitfield_type<std::uint32_t>, "");
-static_assert(!impl::is_bitfield_type<bool>, "");
-static_assert(!impl::is_bitfield_type<std::int32_t>, "");
-static_assert(!impl::is_bitfield_type<std::uint32_t*>, "");
-static_assert(!impl::is_bitfield_type<float>, "");
+static_assert(impl::is_bitfield_type_v<std::uint32_t>, "");
+static_assert(!impl::is_bitfield_type_v<bool>, "");
+static_assert(!impl::is_bitfield_type_v<std::int32_t>, "");
+static_assert(!impl::is_bitfield_type_v<std::uint32_t*>, "");
+static_assert(!impl::is_bitfield_type_v<float>, "");
static_assert(impl::compute_mask<0, 0, std::uint32_t>() == 0x1, "");
static_assert(impl::compute_mask<4, 7, std::uint32_t>() == 0xf0, "");