Project
Loading...
Searching...
No Matches
Endian.h File Reference
#include <cstdint>
#include <concepts>
#include <cstring>
#include <endian.h>

Go to the source code of this file.

Macros

#define swap16_   be16toh
 
#define swap32_   be32toh
 
#define ntohll   be64toh
 
#define htonll   htobe64
 
#define swap64_   ntohll
 
#define O2_HOST_BYTE_ORDER   __BYTE_ORDER
 
#define O2_BIG_ENDIAN   __BIG_ENDIAN
 
#define O2_LITTLE_ENDIAN   __LITTLE_ENDIAN
 

Functions

uint16_t doSwap (std::same_as< uint16_t > auto x)
 
uint32_t doSwap (std::same_as< uint32_t > auto x)
 
uint64_t doSwap (std::same_as< uint64_t > auto x)
 
template<typename T >
void doSwapCopy_ (void *dest, void *source, int size) noexcept
 
void swapCopy (unsigned char *dest, char *source, int size, int typeSize) noexcept
 

Macro Definition Documentation

◆ htonll

#define htonll   htobe64

Definition at line 29 of file Endian.h.

◆ ntohll

#define ntohll   be64toh

Definition at line 28 of file Endian.h.

◆ O2_BIG_ENDIAN

#define O2_BIG_ENDIAN   __BIG_ENDIAN

Definition at line 33 of file Endian.h.

◆ O2_HOST_BYTE_ORDER

#define O2_HOST_BYTE_ORDER   __BYTE_ORDER

Definition at line 32 of file Endian.h.

◆ O2_LITTLE_ENDIAN

#define O2_LITTLE_ENDIAN   __LITTLE_ENDIAN

Definition at line 34 of file Endian.h.

◆ swap16_

#define swap16_   be16toh

Definition at line 26 of file Endian.h.

◆ swap32_

#define swap32_   be32toh

Definition at line 27 of file Endian.h.

◆ swap64_

#define swap64_   ntohll

Definition at line 30 of file Endian.h.

Function Documentation

◆ doSwap() [1/3]

uint16_t doSwap ( std::same_as< uint16_t > auto  x)
inline

Definition at line 36 of file Endian.h.

◆ doSwap() [2/3]

uint32_t doSwap ( std::same_as< uint32_t > auto  x)
inline

Definition at line 41 of file Endian.h.

◆ doSwap() [3/3]

uint64_t doSwap ( std::same_as< uint64_t > auto  x)
inline

Definition at line 46 of file Endian.h.

◆ doSwapCopy_()

template<typename T >
void doSwapCopy_ ( void dest,
void source,
int  size 
)
inlinenoexcept

Definition at line 52 of file Endian.h.

◆ swapCopy()

void swapCopy ( unsigned char dest,
char source,
int  size,
int  typeSize 
)
inlinenoexcept

Definition at line 61 of file Endian.h.