diff --git a/include/upd/basic_ibytestream.hpp b/include/upd/basic_ibytestream.hpp index 8eb107f..a2c1b9a 100644 --- a/include/upd/basic_ibytestream.hpp +++ b/include/upd/basic_ibytestream.hpp @@ -84,14 +84,14 @@ class basic_ibytestream { using byte_t = std::remove_reference_t())>; constexpr static auto byte_width = [] { - if constexpr (detail::is_instance_of_v) { + if constexpr (detail::is_instance_of_v) { return byte_t::width; } else if constexpr (std::is_integral_v) { return std::numeric_limits::digits; } else if constexpr (std::is_enum_v) { return std::numeric_limits>::digits; } else { - static_assert(UPD_ALWAYS_FALSE, "Producers can only produce `integer_t` values, integral values or enumerators"); + static_assert(UPD_ALWAYS_FALSE, "Producers can only produce `extended_integer` values, integral values or enumerators"); } }(); diff --git a/include/upd/integer.hpp b/include/upd/integer.hpp index 518443b..c716de6 100644 --- a/include/upd/integer.hpp +++ b/include/upd/integer.hpp @@ -23,7 +23,7 @@ constexpr auto has_value_member_v = has_value_member::value; namespace upd { template -class integer_t { +class extended_integer { static_assert(detail::has_value_member_v, "`Bitsize` must has a `value` member"); static_assert(std::is_same_v, "`Bitsize::value` must be of type `std::size_t`"); @@ -34,7 +34,7 @@ class integer_t { constexpr static auto is_signed = std::is_signed_v; template - constexpr integer_t(std::integral_constant) noexcept : m_value{Value} { + constexpr extended_integer(std::integral_constant) noexcept : m_value{Value} { if constexpr (Value > 0) { static_assert(Value >> bitsize == 0, "`Value` cannot be represented with `Bitsize` bits"); } else { @@ -55,9 +55,12 @@ class integer_t { }; template -using int_t = integer_t, std::intmax_t>; +using xint = extended_integer, std::intmax_t>; template -using uint_t = integer_t, std::uintmax_t>; +using xuint = extended_integer, std::uintmax_t>; + +template +using xinteger = extended_integer, Underlying>; } // namespace upd