LLVM  3.7.0
Classes | Functions
llvm::support::endian Namespace Reference

Classes

struct  Writer
 Adapter to write values to a stream in a particular byte order. More...
 

Functions

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 , endianness endian, std::size_t alignment>
value_type read (const void *memory)
 Read a value of a particular endianness from memory. More...
 
template<typename value_type , endianness endian, std::size_t alignment, typename CharT >
value_type readNext (const CharT *&memory)
 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>
void write (void *memory, value_type value)
 Write a value to memory with a particular endianness. More...
 
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)
 
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)
 

Function Documentation

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

Swap the bytes of value to match the given endianness.

Definition at line 39 of file Endian.h.

References llvm::support::big, llvm::sys::IsBigEndianHost, llvm::support::native, and llvm::sys::swapByteOrder().

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

Read a value of a particular endianness from memory.

Definition at line 49 of file Endian.h.

References LLVM_ASSUME_ALIGNED.

Referenced by llvm::sys::fs::copy_file(), getMemoryBufferForStream(), getOpenFileImpl(), llvm::sys::fs::identify_magic(), and initialize().

uint16_t llvm::support::endian::read16be ( const void *  p)
inline

Definition at line 214 of file Endian.h.

uint16_t llvm::support::endian::read16le ( const void *  p)
inline
uint32_t llvm::support::endian::read32be ( const void *  p)
inline
uint32_t llvm::support::endian::read32le ( const void *  p)
inline
uint64_t llvm::support::endian::read64be ( const void *  p)
inline
uint64_t llvm::support::endian::read64le ( const void *  p)
inline
template<typename value_type , endianness endian, std::size_t alignment, typename CharT >
value_type llvm::support::endian::readNext ( const CharT *&  memory)
inline

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

Definition at line 63 of file Endian.h.

template<typename value_type , endianness endian, std::size_t alignment>
void llvm::support::endian::write ( void *  memory,
value_type  value 
)
inline
void llvm::support::endian::write16be ( void *  p,
uint16_t  v 
)
inline

Definition at line 221 of file Endian.h.

void llvm::support::endian::write16le ( void *  p,
uint16_t  v 
)
inline

Definition at line 218 of file Endian.h.

void llvm::support::endian::write32be ( void *  p,
uint32_t  v 
)
inline

Definition at line 222 of file Endian.h.

void llvm::support::endian::write32le ( void *  p,
uint32_t  v 
)
inline

Definition at line 219 of file Endian.h.

Referenced by WriteInt32ToBuffer().

void llvm::support::endian::write64be ( void *  p,
uint64_t  v 
)
inline

Definition at line 223 of file Endian.h.

void llvm::support::endian::write64le ( void *  p,
uint64_t  v 
)
inline

Definition at line 220 of file Endian.h.