LLVM API Documentation

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.
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.
template<typename value_type , endianness endian, std::size_t alignment>
value_type readNext (const unsigned char *&memory)
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.

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, and llvm::LibFunc::memcpy.

template<typename value_type , endianness endian, std::size_t alignment>
value_type llvm::support::endian::readNext ( const unsigned char *&  memory) [inline]

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

Definition at line 62 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]

Write a value to memory with a particular endianness.

Definition at line 72 of file Endian.h.

References LLVM_ASSUME_ALIGNED, and llvm::LibFunc::memcpy.