Tuesday
Classes | Typedefs | Enumerations | Functions
<tue/sized_bool.hpp>

Detailed Description

The sized boolean types and their associated utility structs and functions.

Classes

struct  tue::is_sized_bool< T >
 Checks if a type is a sized boolean type. More...
 

Typedefs

template<std::size_t Size>
using tue::sized_bool_t = typename detail_::sized_bool_utils< Size >::type
 A type alias for the sized boolean type (bool8, bool16, bool32, or bool64) with the given size. More...
 

Enumerations

enum  tue::bool8 : std::uint8_t { tue::true8 = UINT8_C(0xFF), tue::false8 = UINT8_C(0x00) }
 An 8-bit boolean value. More...
 
enum  tue::bool16 : std::uint16_t { tue::true16 = UINT16_C(0xFFFF), tue::false16 = UINT16_C(0x0000) }
 A 16-bit boolean value. More...
 
enum  tue::bool32 : std::uint32_t { tue::true32 = UINT32_C(0xFFFFFFFF), tue::false32 = UINT32_C(0x00000000) }
 A 32-bit boolean value. More...
 
enum  tue::bool64 : std::uint64_t { tue::true64 = UINT64_C(0xFFFFFFFFFFFFFFFF), tue::false64 = UINT64_C(0x0000000000000000) }
 A 64-bit boolean value. More...
 

Functions

template<typename T >
constexpr std::enable_if_t< is_sized_bool< T >::value, T > tue::operator~ (T b) noexcept
 Computes the bitwise NOT of b. More...
 
template<typename T >
constexpr std::enable_if_t< is_sized_bool< T >::value, T > tue::operator& (T lhs, T rhs) noexcept
 Computes the bitwise AND of lhs and rhs. More...
 
template<typename T >
constexpr std::enable_if_t< is_sized_bool< T >::value, T > tue::operator| (T lhs, T rhs) noexcept
 Computes the bitwise OR of lhs and rhs. More...
 
template<typename T >
constexpr std::enable_if_t< is_sized_bool< T >::value, T > tue::operator^ (T lhs, T rhs) noexcept
 Computes the bitwise XOR of lhs and rhs. More...
 
template<typename T >
std::enable_if_t< is_sized_bool< T >::value, T & > tue::operator&= (T &lhs, T rhs) noexcept
 Bitwise ANDs lhs with rhs. More...
 
template<typename T >
std::enable_if_t< is_sized_bool< T >::value, T & > tue::operator|= (T &lhs, T rhs) noexcept
 Bitwise ORs lhs with rhs. More...
 
template<typename T >
std::enable_if_t< is_sized_bool< T >::value, T & > tue::operator^= (T &lhs, T rhs) noexcept
 Bitwise XORs lhs with rhs. More...
 

Class Documentation

struct tue::is_sized_bool

template<typename T>
struct tue::is_sized_bool< T >

Checks if a type is a sized boolean type.

Extends std::integral_constant<bool, true> for the following types and std::integral_constant<bool, false> otherwise:

  • tue::bool8
  • tue::bool16
  • tue::bool32
  • tue::bool64
Template Parameters
TThe type to check.

Typedef Documentation

template<std::size_t Size>
using tue::sized_bool_t = typedef typename detail_::sized_bool_utils<Size>::type

A type alias for the sized boolean type (bool8, bool16, bool32, or bool64) with the given size.

Template Parameters
SizeThe desired sized boolean type size (in bytes).

Enumeration Type Documentation

enum tue::bool8 : std::uint8_t

An 8-bit boolean value.

Enumerator
true8 

An 8-bit boolean value with all 8 bits set to 1 (true).

false8 

An 8-bit boolean value with all 8 bits set to 0 (false).

enum tue::bool16 : std::uint16_t

A 16-bit boolean value.

Enumerator
true16 

A 16-bit boolean value with all 16 bits set to 1 (true).

false16 

A 16-bit boolean value with all 16 bits set to 0 (false).

enum tue::bool32 : std::uint32_t

A 32-bit boolean value.

Enumerator
true32 

A 32-bit boolean value with all 32 bits set to 1 (true).

false32 

A 32-bit boolean value with all 32 bits set to 0 (false).

enum tue::bool64 : std::uint64_t

A 64-bit boolean value.

Enumerator
true64 

A 64-bit boolean value with all 64 bits set to 1 (true).

false64 

A 64-bit boolean value with all 64 bits set to 0 (false).

Function Documentation

template<typename T >
constexpr std::enable_if_t<is_sized_bool<T>::value, T> tue::operator~ ( b)
inlinenoexcept

Computes the bitwise NOT of b.

Template Parameters
TThe type of parameter 'b'.
Parameters
bA sized boolean value.
Returns
The bitwise NOT of b.
template<typename T >
constexpr std::enable_if_t<is_sized_bool<T>::value, T> tue::operator& ( lhs,
rhs 
)
inlinenoexcept

Computes the bitwise AND of lhs and rhs.

Template Parameters
TThe type of parameters lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
The bitwise AND of lhs and rhs.
template<typename T >
constexpr std::enable_if_t<is_sized_bool<T>::value, T> tue::operator| ( lhs,
rhs 
)
inlinenoexcept

Computes the bitwise OR of lhs and rhs.

Template Parameters
TThe type of parameters lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
The bitwise OR of lhs and rhs.
template<typename T >
constexpr std::enable_if_t<is_sized_bool<T>::value, T> tue::operator^ ( lhs,
rhs 
)
inlinenoexcept

Computes the bitwise XOR of lhs and rhs.

Template Parameters
TThe type of parameters lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
The bitwise XOR of lhs and rhs.
template<typename T >
std::enable_if_t<is_sized_bool<T>::value, T&> tue::operator&= ( T &  lhs,
rhs 
)
inlinenoexcept

Bitwise ANDs lhs with rhs.

Template Parameters
TThe type of parameters lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
A reference to lhs.
template<typename T >
std::enable_if_t<is_sized_bool<T>::value, T&> tue::operator|= ( T &  lhs,
rhs 
)
inlinenoexcept

Bitwise ORs lhs with rhs.

Template Parameters
TThe type of parameters lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
A reference to lhs.
template<typename T >
std::enable_if_t<is_sized_bool<T>::value, T&> tue::operator^= ( T &  lhs,
rhs 
)
inlinenoexcept

Bitwise XORs lhs with rhs.

Template Parameters
TThe type of parameters lhs and rhs.
Parameters
lhsThe left-hand side operand.
rhsThe right-hand side operand.
Returns
A reference to lhs.