xentara-utils v1.2.1
Xentara utilities library
Loading...
Searching...
No Matches
xentara::utils::numeric::IeeeFloatingPointTraits< Type >::Bits Struct Referencefinal

A type that can store all the bits of the type. More...

#include <numeric/IeeeFloatingPointTraits.hpp>

Public Member Functions

constexpr auto operator&= (const Bits &rhs) noexcept -> Bits &
 Bitwise AND assignment operator.
 
constexpr auto operator|= (const Bits &rhs) noexcept -> Bits &
 Bitwise OR assignment operator.
 
constexpr auto operator^= (const Bits &rhs) noexcept -> Bits &
 Bitwise XOR assignment operator.
 
constexpr auto operator~ () const noexcept -> Bits
 Bitwise XOR assignment operator.
 
constexpr auto operator- () const noexcept -> Bits
 Negation operator.
 
constexpr auto size () const noexcept -> std::size_t
 Gets the number of bytes.
 
constexpr auto operator[] (std::size_t index) const noexcept -> const std::byte &
 Accesses a certain byte.
 
constexpr auto operator[] (std::size_t index) noexcept -> std::byte &
 Accesses a certain byte.
 

Public Attributes

std::byte bytes [sizeof(Type)]
 The actual bytes.
 

Detailed Description

template<typename Type>
struct xentara::utils::numeric::IeeeFloatingPointTraits< Type >::Bits

A type that can store all the bits of the type.

For types that are not IEEE floating point types, this class is an empty dummy class.

Member Function Documentation

◆ operator&=()

template<typename Type >
constexpr auto xentara::utils::numeric::IeeeFloatingPointTraits< Type >::Bits::operator&= ( const Bits rhs) -> Bits &
constexprnoexcept

Bitwise AND assignment operator.

◆ operator-()

template<typename Type >
constexpr auto xentara::utils::numeric::IeeeFloatingPointTraits< Type >::Bits::operator- ( ) const -> Bits
constexprnoexcept

Negation operator.

Returns
An object with the sign bit inverted

◆ operator[]() [1/2]

template<typename Type >
constexpr auto xentara::utils::numeric::IeeeFloatingPointTraits< Type >::Bits::operator[] ( std::size_t  index) const -> const std::byte &
constexprnoexcept

Accesses a certain byte.

Parameters
indexThe index of the byte. Index 0 is always the least significant byte, regardless of endianness.
Returns
a reference to the corresponding byte

◆ operator[]() [2/2]

template<typename Type >
constexpr auto xentara::utils::numeric::IeeeFloatingPointTraits< Type >::Bits::operator[] ( std::size_t  index) -> std::byte &
constexprnoexcept

Accesses a certain byte.

Parameters
indexThe index of the byte. Index 0 is always the least significant byte, regardless of endianness.
Returns
a reference to the corresponding byte

◆ operator^=()

template<typename Type >
constexpr auto xentara::utils::numeric::IeeeFloatingPointTraits< Type >::Bits::operator^= ( const Bits rhs) -> Bits &
constexprnoexcept

Bitwise XOR assignment operator.

◆ operator|=()

template<typename Type >
constexpr auto xentara::utils::numeric::IeeeFloatingPointTraits< Type >::Bits::operator|= ( const Bits rhs) -> Bits &
constexprnoexcept

Bitwise OR assignment operator.

◆ operator~()

template<typename Type >
constexpr auto xentara::utils::numeric::IeeeFloatingPointTraits< Type >::Bits::operator~ ( ) const -> Bits
constexprnoexcept

Bitwise XOR assignment operator.

Returns
An object with all bits inverted

◆ size()

template<typename Type >
constexpr auto xentara::utils::numeric::IeeeFloatingPointTraits< Type >::Bits::size ( ) const -> std::size_t
constexprnoexcept

Gets the number of bytes.

Member Data Documentation

◆ bytes

template<typename Type >
std::byte xentara::utils::numeric::IeeeFloatingPointTraits< Type >::Bits::bytes[sizeof(Type)]

The actual bytes.