byteman  1.3 (Build #225)
Bitstream relocation and manipulation tool
Namespaces | Enumerations | Functions
Endianness.h File Reference
#include <cstdint>
#include <string>
Include dependency graph for Endianness.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 Endian
 

Enumerations

enum class  Endianness {
  BE , LE , BE_BS , LE_BS ,
  NATIVE = (IS_LITTLE_ENDIAN()?LE:BE)
}
 < Endianness in byteman is represented not only by big/little endian, but also by potential bit swapping inside bytes More...
 

Functions

uint16_t Endian::BigEndianToNative16 (uint16_t x)
 
uint32_t Endian::BigEndianToNative32 (uint32_t x)
 
uint64_t Endian::BigEndianToNative64 (uint64_t x)
 
uint8_t Endian::BigEndianToNative8 (uint8_t x)
 
uint16_t Endian::BitSwap16 (uint16_t x)
 
uint32_t Endian::BitSwap32 (uint32_t x)
 
uint64_t Endian::BitSwap64 (uint64_t x)
 
uint8_t Endian::BitSwap8 (uint8_t x)
 
Endianness Endian::diff (Endianness e1, Endianness e2)
 
int IS_LITTLE_ENDIAN ()
 
bool Endian::isBE (Endianness e)
 
bool Endian::isBitSwap (Endianness e)
 
bool Endian::isLE (Endianness e)
 
uint16_t Endian::LittleEndianToNative16 (uint16_t x)
 
uint32_t Endian::LittleEndianToNative32 (uint32_t x)
 
uint64_t Endian::LittleEndianToNative64 (uint64_t x)
 
uint8_t Endian::LittleEndianToNative8 (uint8_t x)
 
uint16_t Endian::NativeToAnyEndianness16 (uint16_t x, Endianness e)
 
uint32_t Endian::NativeToAnyEndianness32 (uint32_t x, Endianness e)
 
uint64_t Endian::NativeToAnyEndianness64 (uint64_t x, Endianness e)
 
uint8_t Endian::NativeToAnyEndianness8 (uint8_t x, Endianness e)
 
uint16_t Endian::NativeToBigEndian16 (uint16_t x)
 
uint32_t Endian::NativeToBigEndian32 (uint32_t x)
 
uint64_t Endian::NativeToBigEndian64 (uint64_t x)
 
uint8_t Endian::NativeToBigEndian8 (uint8_t x)
 
uint16_t Endian::NativeToLittleEndian16 (uint16_t x)
 
uint32_t Endian::NativeToLittleEndian32 (uint32_t x)
 
uint64_t Endian::NativeToLittleEndian64 (uint64_t x)
 
uint8_t Endian::NativeToLittleEndian8 (uint8_t x)
 
uint16_t Endian::swapbytes16 (uint16_t x)
 
uint32_t Endian::swapbytes32 (uint32_t x)
 
uint64_t Endian::swapbytes64 (uint64_t x)
 
std::string Endian::to_string (Endianness e)
 
Endianness Endian::toggleEndianBitSwap (Endianness e, bool toggle=true)
 
Endianness Endian::toggleEndianness (Endianness e, bool toggle=true)
 

Enumeration Type Documentation

◆ Endianness

enum Endianness
strong

< Endianness in byteman is represented not only by big/little endian, but also by potential bit swapping inside bytes

Enumerator
BE 

Big endian ("BE" instead of full-er name, so it does not conflict with linux's reserved endianess words)

LE 

Little endian ("LE" instead of full-er name, so it does not conflict with linux's reserved endianess words)

BE_BS 

Big endian with bit swaps inside each byte.

LE_BS 

Little endian with bit swaps inside each byte.

NATIVE 

System native will always be the fastest endianess to process.

Definition at line 46 of file Endianness.h.

47 {
48  BE,
49  LE,
50  BE_BS,
51  LE_BS,
53 };
@ BE_BS
Big endian with bit swaps inside each byte.
@ LE_BS
Little endian with bit swaps inside each byte.
@ LE
Little endian ("LE" instead of full-er name, so it does not conflict with linux's reserved endianess ...
@ BE
Big endian ("BE" instead of full-er name, so it does not conflict with linux's reserved endianess wor...
@ NATIVE
System native will always be the fastest endianess to process.
int IS_LITTLE_ENDIAN()
Definition: Endianness.h:35

Function Documentation

◆ IS_LITTLE_ENDIAN()

int IS_LITTLE_ENDIAN ( )
inline

Definition at line 35 of file Endianness.h.

36  {
37  union {
38  unsigned int v;
39  unsigned char b;
40  } u;
41  u.v = 1;
42  return u.b;
43  }