L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
Enum_bitops_impl Namespace Reference

Bitwise operators on enumeration types. More...

Functions

template<typename T, typename = L4::Types::Enable_if_t<L4::Types::Is_enum<T>::value>>
constexpr L4::Types::Underlying_type_t< T > to_underlying (T const arg) noexcept
 Convert enum value to its underlying type value.
template<typename T, typename = L4::Types::Enable_if_t<Enum_bitops::Enable<T>::value>>
constexpr T operator~ (T const a) noexcept
 Negate enum value.
template<typename T, typename = L4::Types::Enable_if_t<Enum_bitops::Enable<T>::value>>
constexpr T operator& (T l, T r) noexcept
 Intersect enum values.
template<typename T, typename = L4::Types::Enable_if_t<Enum_bitops::Enable<T>::value>>
constexpr T & operator&= (T &a, T const b) noexcept
 Intersect and assign enum values.
template<typename T, typename = L4::Types::Enable_if_t<Enum_bitops::Enable<T>::value>>
constexpr T operator| (T l, T r) noexcept
 Union enum values.
template<typename T, typename = L4::Types::Enable_if_t<Enum_bitops::Enable<T>::value>>
constexpr T & operator|= (T &a, T const b) noexcept
 Union and assign enum values.
template<typename T, typename = L4::Types::Enable_if_t<Enum_bitops::Enable<T>::value>>
constexpr T operator- (T l, T r) noexcept
 Difference (intersect with negation, clear bits) enum values.
template<typename T, typename = L4::Types::Enable_if_t<Enum_bitops::Enable<T>::value>>
constexpr T & operator-= (T &a, T const b) noexcept
 Difference (intersect with negation, clear bits) and assign enum values.

Detailed Description

Bitwise operators on enumeration types.

These operators allow to use the enum type as a bitmask type with '~', '&' and '|' operators that keep the enum type as result. The compound assignment operators '&=' and '|=' are also provided.

The set-difference '-' and '-=' operators (a shorthand for intersection with a negated second argument) can be used to clear specific bits from the enum value. There is also the to_underlying() helper function.