BitField: Convert typedefs to using aliases
This commit is contained in:
parent
caef08988e
commit
e43c495ce5
|
@ -146,8 +146,11 @@ private:
|
||||||
// T is an enumeration. Note that T is wrapped within an enable_if in the
|
// T is an enumeration. Note that T is wrapped within an enable_if in the
|
||||||
// former case to workaround compile errors which arise when using
|
// former case to workaround compile errors which arise when using
|
||||||
// std::underlying_type<T>::type directly.
|
// std::underlying_type<T>::type directly.
|
||||||
typedef typename std::conditional<std::is_enum<T>::value, std::underlying_type<T>,
|
using StorageType = typename std::conditional_t<std::is_enum<T>::value, std::underlying_type<T>,
|
||||||
std::enable_if<true, T>>::type::type StorageType;
|
std::enable_if<true, T>>::type;
|
||||||
|
|
||||||
|
// Unsigned version of StorageType
|
||||||
|
using StorageTypeU = std::make_unsigned_t<StorageType>;
|
||||||
|
|
||||||
constexpr T Value(std::true_type) const
|
constexpr T Value(std::true_type) const
|
||||||
{
|
{
|
||||||
|
@ -160,9 +163,6 @@ private:
|
||||||
return static_cast<T>((storage & GetMask()) >> position);
|
return static_cast<T>((storage & GetMask()) >> position);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unsigned version of StorageType
|
|
||||||
typedef typename std::make_unsigned<StorageType>::type StorageTypeU;
|
|
||||||
|
|
||||||
static constexpr StorageType GetMask()
|
static constexpr StorageType GetMask()
|
||||||
{
|
{
|
||||||
return (((StorageTypeU)~0) >> (8 * sizeof(T) - bits)) << position;
|
return (((StorageTypeU)~0) >> (8 * sizeof(T) - bits)) << position;
|
||||||
|
|
Loading…
Reference in New Issue