WPILibC++ 2023.4.3-108-ge5452e3
wpi::support::endian Namespace Reference

Typedefs

template<typename value_type >
using make_unsigned_t = std::make_unsigned_t< value_type >
 

Functions

constexpr endianness system_endianness ()
 
template<typename value_type >
value_type byte_swap (value_type value, endianness endian)
 
template<typename value_type , endianness endian>
value_type byte_swap (value_type value)
 Swap the bytes of value to match the given endianness. More...
 
template<typename value_type , std::size_t alignment>
value_type read (const void *memory, endianness endian)
 Read a value of a particular endianness from memory. More...
 
template<typename value_type , endianness endian, std::size_t alignment>
value_type read (const void *memory)
 
template<typename value_type , std::size_t alignment, typename CharT >
value_type readNext (const CharT *&memory, endianness endian)
 Read a value of a particular endianness from a buffer, and increment the buffer past that value. More...
 
template<typename value_type , endianness endian, std::size_t alignment, typename CharT >
value_type readNext (const CharT *&memory)
 
template<typename value_type , std::size_t alignment>
void write (void *memory, value_type value, endianness endian)
 Write a value to memory with a particular endianness. More...
 
template<typename value_type , endianness endian, std::size_t alignment>
void write (void *memory, value_type value)
 
template<typename value_type , endianness endian, std::size_t alignment>
value_type readAtBitAlignment (const void *memory, uint64_t startBit)
 Read a value of a particular endianness from memory, for a location that starts at the given bit offset within the first byte. More...
 
template<typename value_type , endianness endian, std::size_t alignment>
void writeAtBitAlignment (void *memory, value_type value, uint64_t startBit)
 Write a value to memory with a particular endianness, for a location that starts at the given bit offset within the first byte. More...
 
template<typename T >
read (const void *P, endianness E)
 
template<typename T , endianness E>
read (const void *P)
 
uint16_t read16 (const void *P, endianness E)
 
uint32_t read32 (const void *P, endianness E)
 
uint64_t read64 (const void *P, endianness E)
 
template<endianness E>
uint16_t read16 (const void *P)
 
template<endianness E>
uint32_t read32 (const void *P)
 
template<endianness E>
uint64_t read64 (const void *P)
 
uint16_t read16le (const void *P)
 
uint32_t read32le (const void *P)
 
uint64_t read64le (const void *P)
 
uint16_t read16be (const void *P)
 
uint32_t read32be (const void *P)
 
uint64_t read64be (const void *P)
 
template<typename T >
void write (void *P, T V, endianness E)
 
template<typename T , endianness E>
void write (void *P, T V)
 
void write16 (void *P, uint16_t V, endianness E)
 
void write32 (void *P, uint32_t V, endianness E)
 
void write64 (void *P, uint64_t V, endianness E)
 
template<endianness E>
void write16 (void *P, uint16_t V)
 
template<endianness E>
void write32 (void *P, uint32_t V)
 
template<endianness E>
void write64 (void *P, uint64_t V)
 
void write16le (void *P, uint16_t V)
 
void write32le (void *P, uint32_t V)
 
void write64le (void *P, uint64_t V)
 
void write16be (void *P, uint16_t V)
 
void write32be (void *P, uint32_t V)
 
void write64be (void *P, uint64_t V)
 

Typedef Documentation

◆ make_unsigned_t

template<typename value_type >
using wpi::support::endian::make_unsigned_t = typedef std::make_unsigned_t<value_type>

Function Documentation

◆ byte_swap() [1/2]

template<typename value_type , endianness endian>
value_type wpi::support::endian::byte_swap ( value_type  value)
inline

Swap the bytes of value to match the given endianness.

◆ byte_swap() [2/2]

template<typename value_type >
value_type wpi::support::endian::byte_swap ( value_type  value,
endianness  endian 
)
inline

◆ read() [1/4]

template<typename value_type , endianness endian, std::size_t alignment>
value_type wpi::support::endian::read ( const void *  memory)
inline

◆ read() [2/4]

template<typename value_type , std::size_t alignment>
value_type wpi::support::endian::read ( const void *  memory,
endianness  endian 
)
inline

Read a value of a particular endianness from memory.

◆ read() [3/4]

template<typename T , endianness E>
T wpi::support::endian::read ( const void *  P)
inline

◆ read() [4/4]

template<typename T >
T wpi::support::endian::read ( const void *  P,
endianness  E 
)
inline

◆ read16() [1/2]

template<endianness E>
uint16_t wpi::support::endian::read16 ( const void *  P)
inline

◆ read16() [2/2]

uint16_t wpi::support::endian::read16 ( const void *  P,
endianness  E 
)
inline

◆ read16be()

uint16_t wpi::support::endian::read16be ( const void *  P)
inline

◆ read16le()

uint16_t wpi::support::endian::read16le ( const void *  P)
inline

◆ read32() [1/2]

template<endianness E>
uint32_t wpi::support::endian::read32 ( const void *  P)
inline

◆ read32() [2/2]

uint32_t wpi::support::endian::read32 ( const void *  P,
endianness  E 
)
inline

◆ read32be()

uint32_t wpi::support::endian::read32be ( const void *  P)
inline

◆ read32le()

uint32_t wpi::support::endian::read32le ( const void *  P)
inline

◆ read64() [1/2]

template<endianness E>
uint64_t wpi::support::endian::read64 ( const void *  P)
inline

◆ read64() [2/2]

uint64_t wpi::support::endian::read64 ( const void *  P,
endianness  E 
)
inline

◆ read64be()

uint64_t wpi::support::endian::read64be ( const void *  P)
inline

◆ read64le()

uint64_t wpi::support::endian::read64le ( const void *  P)
inline

◆ readAtBitAlignment()

template<typename value_type , endianness endian, std::size_t alignment>
value_type wpi::support::endian::readAtBitAlignment ( const void *  memory,
uint64_t  startBit 
)
inline

Read a value of a particular endianness from memory, for a location that starts at the given bit offset within the first byte.

◆ readNext() [1/2]

template<typename value_type , endianness endian, std::size_t alignment, typename CharT >
value_type wpi::support::endian::readNext ( const CharT *&  memory)
inline

◆ readNext() [2/2]

template<typename value_type , std::size_t alignment, typename CharT >
value_type wpi::support::endian::readNext ( const CharT *&  memory,
endianness  endian 
)
inline

Read a value of a particular endianness from a buffer, and increment the buffer past that value.

◆ system_endianness()

constexpr endianness wpi::support::endian::system_endianness ( )
constexpr

◆ write() [1/4]

template<typename value_type , endianness endian, std::size_t alignment>
void wpi::support::endian::write ( void *  memory,
value_type  value 
)
inline

◆ write() [2/4]

template<typename value_type , std::size_t alignment>
void wpi::support::endian::write ( void *  memory,
value_type  value,
endianness  endian 
)
inline

Write a value to memory with a particular endianness.

◆ write() [3/4]

template<typename T , endianness E>
void wpi::support::endian::write ( void *  P,
V 
)
inline

◆ write() [4/4]

template<typename T >
void wpi::support::endian::write ( void *  P,
V,
endianness  E 
)
inline

◆ write16() [1/2]

template<endianness E>
void wpi::support::endian::write16 ( void *  P,
uint16_t  V 
)
inline

◆ write16() [2/2]

void wpi::support::endian::write16 ( void *  P,
uint16_t  V,
endianness  E 
)
inline

◆ write16be()

void wpi::support::endian::write16be ( void *  P,
uint16_t  V 
)
inline

◆ write16le()

void wpi::support::endian::write16le ( void *  P,
uint16_t  V 
)
inline

◆ write32() [1/2]

template<endianness E>
void wpi::support::endian::write32 ( void *  P,
uint32_t  V 
)
inline

◆ write32() [2/2]

void wpi::support::endian::write32 ( void *  P,
uint32_t  V,
endianness  E 
)
inline

◆ write32be()

void wpi::support::endian::write32be ( void *  P,
uint32_t  V 
)
inline

◆ write32le()

void wpi::support::endian::write32le ( void *  P,
uint32_t  V 
)
inline

◆ write64() [1/2]

template<endianness E>
void wpi::support::endian::write64 ( void *  P,
uint64_t  V 
)
inline

◆ write64() [2/2]

void wpi::support::endian::write64 ( void *  P,
uint64_t  V,
endianness  E 
)
inline

◆ write64be()

void wpi::support::endian::write64be ( void *  P,
uint64_t  V 
)
inline

◆ write64le()

void wpi::support::endian::write64le ( void *  P,
uint64_t  V 
)
inline

◆ writeAtBitAlignment()

template<typename value_type , endianness endian, std::size_t alignment>
void wpi::support::endian::writeAtBitAlignment ( void *  memory,
value_type  value,
uint64_t  startBit 
)
inline

Write a value to memory with a particular endianness, for a location that starts at the given bit offset within the first byte.