ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ByteOrder Namespace Reference

Enumerations

enum  Endianness {
  ORDER_UNSPECIFIED =0,
  ORDER_LSB,
  ORDER_MSB
}
 

Functions

Endianness host_order ()
 Byte order of host machine. More...
 
void convert (void *bytes_, size_t nbytes, Endianness from, Endianness to)
 Convert data from one byte order to another in place. More...
 
int8_t swap_bytes (int8_t n)
 Reverse bytes. More...
 
uint8_t swap_bytes (uint8_t n)
 Reverse bytes. More...
 
int16_t swap_bytes (int16_t n)
 Reverse bytes. More...
 
uint16_t swap_bytes (uint16_t n)
 Reverse bytes. More...
 
int32_t swap_bytes (int32_t n)
 Reverse bytes. More...
 
uint32_t swap_bytes (uint32_t n)
 Reverse bytes. More...
 
int64_t swap_bytes (int64_t n)
 Reverse bytes. More...
 
uint64_t swap_bytes (uint64_t n)
 Reverse bytes. More...
 
int8_t le_to_host (int8_t n)
 Convert a little-endian integer to host order. More...
 
uint8_t le_to_host (uint8_t n)
 Convert a little-endian integer to host order. More...
 
int16_t le_to_host (int16_t n)
 Convert a little-endian integer to host order. More...
 
uint16_t le_to_host (uint16_t n)
 Convert a little-endian integer to host order. More...
 
int32_t le_to_host (int32_t n)
 Convert a little-endian integer to host order. More...
 
uint32_t le_to_host (uint32_t n)
 Convert a little-endian integer to host order. More...
 
int64_t le_to_host (int64_t n)
 Convert a little-endian integer to host order. More...
 
uint64_t le_to_host (uint64_t n)
 Convert a little-endian integer to host order. More...
 
void host_to_le (unsigned h, uint8_t *n)
 Convert host order to little-endian. More...
 
void host_to_le (unsigned h, uint16_t *n)
 Convert host order to little-endian. More...
 
void host_to_le (unsigned h, uint32_t *n)
 Convert host order to little-endian. More...
 
void host_to_le (rose_addr_t h, uint64_t *n)
 Convert host order to little-endian. More...
 
void host_to_le (rose_rva_t h, uint32_t *n)
 Convert host order to little-endian. More...
 
void host_to_le (rose_rva_t h, uint64_t *n)
 Convert host order to little-endian. More...
 
void host_to_le (int h, int8_t *n)
 Convert host order to little-endian. More...
 
void host_to_le (int h, int16_t *n)
 Convert host order to little-endian. More...
 
void host_to_le (int h, int32_t *n)
 Convert host order to little-endian. More...
 
void host_to_le (int64_t h, int64_t *n)
 Convert host order to little-endian. More...
 
uint8_t be_to_host (uint8_t n)
 Convert a bit-endian integer to host order. More...
 
uint16_t be_to_host (uint16_t n)
 Convert a bit-endian integer to host order. More...
 
uint32_t be_to_host (uint32_t n)
 Convert a bit-endian integer to host order. More...
 
uint64_t be_to_host (uint64_t n)
 Convert a bit-endian integer to host order. More...
 
int8_t be_to_host (int8_t n)
 Convert a bit-endian integer to host order. More...
 
int16_t be_to_host (int16_t n)
 Convert a bit-endian integer to host order. More...
 
int32_t be_to_host (int32_t n)
 Convert a bit-endian integer to host order. More...
 
int64_t be_to_host (int64_t n)
 Convert a bit-endian integer to host order. More...
 
void host_to_be (unsigned h, uint8_t *n)
 Convert host order to big endian. More...
 
void host_to_be (unsigned h, uint16_t *n)
 Convert host order to big endian. More...
 
void host_to_be (unsigned h, uint32_t *n)
 Convert host order to big endian. More...
 
void host_to_be (rose_addr_t h, uint64_t *n)
 Convert host order to big endian. More...
 
void host_to_be (rose_rva_t h, uint32_t *n)
 Convert host order to big endian. More...
 
void host_to_be (rose_rva_t h, uint64_t *n)
 Convert host order to big endian. More...
 
void host_to_be (int h, int8_t *n)
 Convert host order to big endian. More...
 
void host_to_be (int h, int16_t *n)
 Convert host order to big endian. More...
 
void host_to_be (int h, int32_t *n)
 Convert host order to big endian. More...
 
void host_to_be (int64_t h, int64_t *n)
 Convert host order to big endian. More...
 
uint8_t disk_to_host (Endianness sex, uint8_t n)
 Convert call-specified order to host order. More...
 
uint16_t disk_to_host (Endianness sex, uint16_t n)
 Convert call-specified order to host order. More...
 
uint32_t disk_to_host (Endianness sex, uint32_t n)
 Convert call-specified order to host order. More...
 
uint64_t disk_to_host (Endianness sex, uint64_t n)
 Convert call-specified order to host order. More...
 
int8_t disk_to_host (Endianness sex, int8_t n)
 Convert call-specified order to host order. More...
 
int16_t disk_to_host (Endianness sex, int16_t n)
 Convert call-specified order to host order. More...
 
int32_t disk_to_host (Endianness sex, int32_t n)
 Convert call-specified order to host order. More...
 
int64_t disk_to_host (Endianness sex, int64_t n)
 Convert call-specified order to host order. More...
 
void host_to_disk (Endianness sex, unsigned h, uint8_t *np)
 Convert host order to caller-specified order. More...
 
void host_to_disk (Endianness sex, unsigned h, uint16_t *np)
 Convert call-specified order to host order. More...
 
void host_to_disk (Endianness sex, unsigned h, uint32_t *np)
 Convert call-specified order to host order. More...
 
void host_to_disk (Endianness sex, rose_addr_t h, uint64_t *np)
 Convert call-specified order to host order. More...
 
void host_to_disk (Endianness sex, rose_rva_t h, uint64_t *np)
 Convert call-specified order to host order. More...
 
void host_to_disk (Endianness sex, int h, int8_t *np)
 Convert call-specified order to host order. More...
 
void host_to_disk (Endianness sex, int h, int16_t *np)
 Convert call-specified order to host order. More...
 
void host_to_disk (Endianness sex, int h, int32_t *np)
 Convert call-specified order to host order. More...
 
void host_to_disk (Endianness sex, int64_t h, int64_t *np)
 Convert call-specified order to host order. More...
 

Enumeration Type Documentation

Enumerator
ORDER_UNSPECIFIED 

Endianness is unspecified and unknown.

ORDER_LSB 

Least significant byte first, i.e., little-endian.

ORDER_MSB 

Most significant byte first, i.e., big-endian.

Definition at line 7 of file ByteOrder.h.

Function Documentation

Endianness ByteOrder::host_order ( )

Byte order of host machine.

Referenced by SgAsmElfFileHeader::parse().

void ByteOrder::convert ( void *  bytes_,
size_t  nbytes,
Endianness  from,
Endianness  to 
)

Convert data from one byte order to another in place.

int8_t ByteOrder::swap_bytes ( int8_t  n)

Reverse bytes.

uint8_t ByteOrder::swap_bytes ( uint8_t  n)

Reverse bytes.

int16_t ByteOrder::swap_bytes ( int16_t  n)

Reverse bytes.

uint16_t ByteOrder::swap_bytes ( uint16_t  n)

Reverse bytes.

int32_t ByteOrder::swap_bytes ( int32_t  n)

Reverse bytes.

uint32_t ByteOrder::swap_bytes ( uint32_t  n)

Reverse bytes.

int64_t ByteOrder::swap_bytes ( int64_t  n)

Reverse bytes.

uint64_t ByteOrder::swap_bytes ( uint64_t  n)

Reverse bytes.

uint8_t ByteOrder::le_to_host ( uint8_t  n)

Convert a little-endian integer to host order.

int16_t ByteOrder::le_to_host ( int16_t  n)

Convert a little-endian integer to host order.

uint16_t ByteOrder::le_to_host ( uint16_t  n)

Convert a little-endian integer to host order.

int32_t ByteOrder::le_to_host ( int32_t  n)

Convert a little-endian integer to host order.

uint32_t ByteOrder::le_to_host ( uint32_t  n)

Convert a little-endian integer to host order.

int64_t ByteOrder::le_to_host ( int64_t  n)

Convert a little-endian integer to host order.

uint64_t ByteOrder::le_to_host ( uint64_t  n)

Convert a little-endian integer to host order.

void ByteOrder::host_to_le ( unsigned  h,
uint16_t *  n 
)

Convert host order to little-endian.

void ByteOrder::host_to_le ( unsigned  h,
uint32_t *  n 
)

Convert host order to little-endian.

void ByteOrder::host_to_le ( rose_addr_t  h,
uint64_t *  n 
)

Convert host order to little-endian.

void ByteOrder::host_to_le ( rose_rva_t  h,
uint32_t *  n 
)

Convert host order to little-endian.

void ByteOrder::host_to_le ( rose_rva_t  h,
uint64_t *  n 
)

Convert host order to little-endian.

void ByteOrder::host_to_le ( int  h,
int8_t *  n 
)

Convert host order to little-endian.

void ByteOrder::host_to_le ( int  h,
int16_t *  n 
)

Convert host order to little-endian.

void ByteOrder::host_to_le ( int  h,
int32_t *  n 
)

Convert host order to little-endian.

void ByteOrder::host_to_le ( int64_t  h,
int64_t *  n 
)

Convert host order to little-endian.

uint8_t ByteOrder::be_to_host ( uint8_t  n)

Convert a bit-endian integer to host order.

uint16_t ByteOrder::be_to_host ( uint16_t  n)

Convert a bit-endian integer to host order.

uint32_t ByteOrder::be_to_host ( uint32_t  n)

Convert a bit-endian integer to host order.

uint64_t ByteOrder::be_to_host ( uint64_t  n)

Convert a bit-endian integer to host order.

int8_t ByteOrder::be_to_host ( int8_t  n)

Convert a bit-endian integer to host order.

int16_t ByteOrder::be_to_host ( int16_t  n)

Convert a bit-endian integer to host order.

int32_t ByteOrder::be_to_host ( int32_t  n)

Convert a bit-endian integer to host order.

int64_t ByteOrder::be_to_host ( int64_t  n)

Convert a bit-endian integer to host order.

void ByteOrder::host_to_be ( unsigned  h,
uint8_t *  n 
)

Convert host order to big endian.

void ByteOrder::host_to_be ( unsigned  h,
uint16_t *  n 
)

Convert host order to big endian.

void ByteOrder::host_to_be ( unsigned  h,
uint32_t *  n 
)

Convert host order to big endian.

void ByteOrder::host_to_be ( rose_addr_t  h,
uint64_t *  n 
)

Convert host order to big endian.

void ByteOrder::host_to_be ( rose_rva_t  h,
uint32_t *  n 
)

Convert host order to big endian.

void ByteOrder::host_to_be ( rose_rva_t  h,
uint64_t *  n 
)

Convert host order to big endian.

void ByteOrder::host_to_be ( int  h,
int8_t *  n 
)

Convert host order to big endian.

void ByteOrder::host_to_be ( int  h,
int16_t *  n 
)

Convert host order to big endian.

void ByteOrder::host_to_be ( int  h,
int32_t *  n 
)

Convert host order to big endian.

void ByteOrder::host_to_be ( int64_t  h,
int64_t *  n 
)

Convert host order to big endian.

uint16_t ByteOrder::disk_to_host ( Endianness  sex,
uint16_t  n 
)

Convert call-specified order to host order.

uint32_t ByteOrder::disk_to_host ( Endianness  sex,
uint32_t  n 
)

Convert call-specified order to host order.

uint64_t ByteOrder::disk_to_host ( Endianness  sex,
uint64_t  n 
)

Convert call-specified order to host order.

int8_t ByteOrder::disk_to_host ( Endianness  sex,
int8_t  n 
)

Convert call-specified order to host order.

int16_t ByteOrder::disk_to_host ( Endianness  sex,
int16_t  n 
)

Convert call-specified order to host order.

int32_t ByteOrder::disk_to_host ( Endianness  sex,
int32_t  n 
)

Convert call-specified order to host order.

int64_t ByteOrder::disk_to_host ( Endianness  sex,
int64_t  n 
)

Convert call-specified order to host order.

void ByteOrder::host_to_disk ( Endianness  sex,
unsigned  h,
uint16_t *  np 
)

Convert call-specified order to host order.

void ByteOrder::host_to_disk ( Endianness  sex,
unsigned  h,
uint32_t *  np 
)

Convert call-specified order to host order.

void ByteOrder::host_to_disk ( Endianness  sex,
rose_addr_t  h,
uint64_t *  np 
)

Convert call-specified order to host order.

void ByteOrder::host_to_disk ( Endianness  sex,
rose_rva_t  h,
uint64_t *  np 
)

Convert call-specified order to host order.

void ByteOrder::host_to_disk ( Endianness  sex,
int  h,
int8_t *  np 
)

Convert call-specified order to host order.

void ByteOrder::host_to_disk ( Endianness  sex,
int  h,
int16_t *  np 
)

Convert call-specified order to host order.

void ByteOrder::host_to_disk ( Endianness  sex,
int  h,
int32_t *  np 
)

Convert call-specified order to host order.

void ByteOrder::host_to_disk ( Endianness  sex,
int64_t  h,
int64_t *  np 
)

Convert call-specified order to host order.