FreeNOS
ByteOrder.h File Reference
#include "Types.h"
#include "MemoryBlock.h"

Go to the source code of this file.

Macros

#define SWAP16(x)
 Byte swap functions. More...
 
#define SWAP32(x)
 Byte swap a 32-bit integer. More...
 
#define SWAP64(x)
 Byte swap a 64-bit integer. More...
 
#define cpu_to_le64(x)   ((le64)(u64)(x))
 Integer conversion functions. More...
 
#define le64_to_cpu(x)   ((u64)(le64)(x))
 Little endian 64-bit to CPU byte order. More...
 
#define cpu_to_le32(x)   ((le32)(u32)(x))
 CPU byte order to little endian 32-bit. More...
 
#define le32_to_cpu(x)   ((u32)(le32)(x))
 Little endian 32-bit to CPU byte order. More...
 
#define cpu_to_le16(x)   ((le16)(u16)(x))
 CPU byte order to little endian 16-bit. More...
 
#define le16_to_cpu(x)   ((u16)(le16)(x))
 Little endian 16-bit to CPU byte order. More...
 
#define cpu_to_be64(x)   ((be64)SWAP64((x)))
 CPU byte order to big endian 64-bit. More...
 
#define be64_to_cpu(x)   SWAP64((u64)(be64)(x))
 Big endian 64-bit to CPU byte order. More...
 
#define cpu_to_be32(x)   ((be32)SWAP32((x)))
 CPU byte order to big endian 32-bit. More...
 
#define be32_to_cpu(x)   SWAP32((u32)(be32)(x))
 Big endian 32-bit to CPU byte order. More...
 
#define cpu_to_be16(x)   ((be16)SWAP16((x)))
 CPU byte order to big endian 16-bit. More...
 
#define be16_to_cpu(x)   SWAP16((u16)(be16)(x))
 Big endian 16-bit to CPU byte order. More...
 

Functions

const u64 read64 (const void *data)
 Memory read/write functions. More...
 
const u32 read32 (const void *data)
 Read 32-bit integer (no conversion) More...
 
const u16 read16 (const void *data)
 Read 16-bit integer (no conversion) More...
 
const u8 read8 (const void *data)
 Read 8-bit integer. More...
 
void write64 (void *data, const u64 input)
 Write 64-bit integer (no conversion) More...
 
void write32 (void *data, const u32 input)
 Write 32-bit integer (no conversion) More...
 
void write16 (void *data, const u16 input)
 Write 16-bit integer (no conversion) More...
 
void write8 (void *data, const u8 input)
 Write 8-bit integer. More...
 
const u64 readLe64 (const void *data)
 Read 64-bit little endian integer. More...
 
const u32 readLe32 (const void *data)
 Read 32-bit little endian integer. More...
 
const u16 readLe16 (const void *data)
 Read 16-bit little endian integer. More...
 
const u64 readBe64 (const void *data)
 Read 64-bit big endian integer. More...
 
const u32 readBe32 (const void *data)
 Read 32-bit big endian integer. More...
 
const u16 readBe16 (const void *data)
 Read 16-bit big endian integer. More...
 
void writeLe64 (void *data, const u64 input)
 Write 64-bit little endian integer. More...
 
void writeLe32 (void *data, const u32 input)
 Write 32-bit little endian integer. More...
 
void writeLe16 (void *data, const u16 input)
 Write 16-bit little endian integer. More...
 
void writeBe64 (void *data, const u64 input)
 Write 64-bit big endian integer. More...
 
void writeBe32 (void *data, const u32 input)
 Write 32-bit big endian integer. More...
 
void writeBe16 (void *data, const u16 input)
 Write 16-bit big endian integer. More...