LLVM 20.0.0git
Classes | Namespaces | Typedefs | Enumerations | Functions
Endian.h File Reference
#include "llvm/ADT/bit.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/SwapByteOrder.h"
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <type_traits>

Go to the source code of this file.

Classes

struct  llvm::support::detail::PickAlignment< T, alignment >
 value is either alignment, or alignof(T) if alignment is 0. More...
 
struct  llvm::support::detail::packed_endian_specific_integral< ValueType, Endian, Alignment, ALIGN >
 
struct  llvm::support::detail::packed_endian_specific_integral< ValueType, Endian, Alignment, ALIGN >::ref
 

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.
 
namespace  llvm::support
 
namespace  llvm::support::detail
 
namespace  llvm::support::endian
 

Typedefs

template<typename value_type >
using llvm::support::endian::make_unsigned_t = std::make_unsigned_t< value_type >
 
using llvm::support::ulittle16_t = detail::packed_endian_specific_integral< uint16_t, llvm::endianness::little, unaligned >
 
using llvm::support::ulittle32_t = detail::packed_endian_specific_integral< uint32_t, llvm::endianness::little, unaligned >
 
using llvm::support::ulittle64_t = detail::packed_endian_specific_integral< uint64_t, llvm::endianness::little, unaligned >
 
using llvm::support::little16_t = detail::packed_endian_specific_integral< int16_t, llvm::endianness::little, unaligned >
 
using llvm::support::little32_t = detail::packed_endian_specific_integral< int32_t, llvm::endianness::little, unaligned >
 
using llvm::support::little64_t = detail::packed_endian_specific_integral< int64_t, llvm::endianness::little, unaligned >
 
using llvm::support::aligned_ulittle16_t = detail::packed_endian_specific_integral< uint16_t, llvm::endianness::little, aligned >
 
using llvm::support::aligned_ulittle32_t = detail::packed_endian_specific_integral< uint32_t, llvm::endianness::little, aligned >
 
using llvm::support::aligned_ulittle64_t = detail::packed_endian_specific_integral< uint64_t, llvm::endianness::little, aligned >
 
using llvm::support::aligned_little16_t = detail::packed_endian_specific_integral< int16_t, llvm::endianness::little, aligned >
 
using llvm::support::aligned_little32_t = detail::packed_endian_specific_integral< int32_t, llvm::endianness::little, aligned >
 
using llvm::support::aligned_little64_t = detail::packed_endian_specific_integral< int64_t, llvm::endianness::little, aligned >
 
using llvm::support::ubig16_t = detail::packed_endian_specific_integral< uint16_t, llvm::endianness::big, unaligned >
 
using llvm::support::ubig32_t = detail::packed_endian_specific_integral< uint32_t, llvm::endianness::big, unaligned >
 
using llvm::support::ubig64_t = detail::packed_endian_specific_integral< uint64_t, llvm::endianness::big, unaligned >
 
using llvm::support::big16_t = detail::packed_endian_specific_integral< int16_t, llvm::endianness::big, unaligned >
 
using llvm::support::big32_t = detail::packed_endian_specific_integral< int32_t, llvm::endianness::big, unaligned >
 
using llvm::support::big64_t = detail::packed_endian_specific_integral< int64_t, llvm::endianness::big, unaligned >
 
using llvm::support::aligned_ubig16_t = detail::packed_endian_specific_integral< uint16_t, llvm::endianness::big, aligned >
 
using llvm::support::aligned_ubig32_t = detail::packed_endian_specific_integral< uint32_t, llvm::endianness::big, aligned >
 
using llvm::support::aligned_ubig64_t = detail::packed_endian_specific_integral< uint64_t, llvm::endianness::big, aligned >
 
using llvm::support::aligned_big16_t = detail::packed_endian_specific_integral< int16_t, llvm::endianness::big, aligned >
 
using llvm::support::aligned_big32_t = detail::packed_endian_specific_integral< int32_t, llvm::endianness::big, aligned >
 
using llvm::support::aligned_big64_t = detail::packed_endian_specific_integral< int64_t, llvm::endianness::big, aligned >
 
using llvm::support::unaligned_uint16_t = detail::packed_endian_specific_integral< uint16_t, llvm::endianness::native, unaligned >
 
using llvm::support::unaligned_uint32_t = detail::packed_endian_specific_integral< uint32_t, llvm::endianness::native, unaligned >
 
using llvm::support::unaligned_uint64_t = detail::packed_endian_specific_integral< uint64_t, llvm::endianness::native, unaligned >
 
using llvm::support::unaligned_int16_t = detail::packed_endian_specific_integral< int16_t, llvm::endianness::native, unaligned >
 
using llvm::support::unaligned_int32_t = detail::packed_endian_specific_integral< int32_t, llvm::endianness::native, unaligned >
 
using llvm::support::unaligned_int64_t = detail::packed_endian_specific_integral< int64_t, llvm::endianness::native, unaligned >
 
template<typename T >
using llvm::support::little_t = detail::packed_endian_specific_integral< T, llvm::endianness::little, unaligned >
 
template<typename T >
using llvm::support::big_t = detail::packed_endian_specific_integral< T, llvm::endianness::big, unaligned >
 
template<typename T >
using llvm::support::aligned_little_t = detail::packed_endian_specific_integral< T, llvm::endianness::little, aligned >
 
template<typename T >
using llvm::support::aligned_big_t = detail::packed_endian_specific_integral< T, llvm::endianness::big, aligned >
 

Enumerations

enum  { llvm::support::aligned = 0 , llvm::support::unaligned = 1 }
 

Functions

template<typename value_type >
value_type llvm::support::endian::byte_swap (value_type value, endianness endian)
 
template<typename value_type , endianness endian>
value_type llvm::support::endian::byte_swap (value_type value)
 Swap the bytes of value to match the given endianness.
 
template<typename value_type , std::size_t alignment = unaligned>
value_type llvm::support::endian::read (const void *memory, endianness endian)
 Read a value of a particular endianness from memory.
 
template<typename value_type , endianness endian, std::size_t alignment>
value_type llvm::support::endian::read (const void *memory)
 
template<typename value_type , std::size_t alignment = unaligned, typename CharT >
value_type llvm::support::endian::readNext (const CharT *&memory, endianness endian)
 Read a value of a particular endianness from a buffer, and increment the buffer past that value.
 
template<typename value_type , endianness endian, std::size_t alignment = unaligned, typename CharT >
value_type llvm::support::endian::readNext (const CharT *&memory)
 
template<typename value_type , std::size_t alignment = unaligned>
void llvm::support::endian::write (void *memory, value_type value, endianness endian)
 Write a value to memory with a particular endianness.
 
template<typename value_type , endianness endian, std::size_t alignment>
void llvm::support::endian::write (void *memory, value_type value)
 
template<typename value_type , std::size_t alignment = unaligned, typename CharT >
void llvm::support::endian::writeNext (CharT *&memory, value_type value, endianness endian)
 Write a value of a particular endianness, and increment the buffer past that value.
 
template<typename value_type , endianness endian, std::size_t alignment = unaligned, typename CharT >
void llvm::support::endian::writeNext (CharT *&memory, value_type value)
 
template<typename value_type , endianness endian, std::size_t alignment>
value_type llvm::support::endian::readAtBitAlignment (const void *memory, uint64_t startBit)
 Read a value of a particular endianness from memory, for a location that starts at the given bit offset within the first byte.
 
template<typename value_type , endianness endian, std::size_t alignment>
void llvm::support::endian::writeAtBitAlignment (void *memory, value_type value, uint64_t startBit)
 Write a value to memory with a particular endianness, for a location that starts at the given bit offset within the first byte.
 
template<typename T , endianness E>
T llvm::support::endian::read (const void *P)
 
uint16_t llvm::support::endian::read16 (const void *P, endianness E)
 
uint32_t llvm::support::endian::read32 (const void *P, endianness E)
 
uint64_t llvm::support::endian::read64 (const void *P, endianness E)
 
template<endianness E>
uint16_t llvm::support::endian::read16 (const void *P)
 
template<endianness E>
uint32_t llvm::support::endian::read32 (const void *P)
 
template<endianness E>
uint64_t llvm::support::endian::read64 (const void *P)
 
uint16_t llvm::support::endian::read16le (const void *P)
 
uint32_t llvm::support::endian::read32le (const void *P)
 
uint64_t llvm::support::endian::read64le (const void *P)
 
uint16_t llvm::support::endian::read16be (const void *P)
 
uint32_t llvm::support::endian::read32be (const void *P)
 
uint64_t llvm::support::endian::read64be (const void *P)
 
template<typename T , endianness E>
void llvm::support::endian::write (void *P, T V)
 
void llvm::support::endian::write16 (void *P, uint16_t V, endianness E)
 
void llvm::support::endian::write32 (void *P, uint32_t V, endianness E)
 
void llvm::support::endian::write64 (void *P, uint64_t V, endianness E)
 
template<endianness E>
void llvm::support::endian::write16 (void *P, uint16_t V)
 
template<endianness E>
void llvm::support::endian::write32 (void *P, uint32_t V)
 
template<endianness E>
void llvm::support::endian::write64 (void *P, uint64_t V)
 
void llvm::support::endian::write16le (void *P, uint16_t V)
 
void llvm::support::endian::write32le (void *P, uint32_t V)
 
void llvm::support::endian::write64le (void *P, uint64_t V)
 
void llvm::support::endian::write16be (void *P, uint16_t V)
 
void llvm::support::endian::write32be (void *P, uint32_t V)
 
void llvm::support::endian::write64be (void *P, uint64_t V)