31#ifndef ETL_UNALIGNED_TYPE_INCLUDED
32#define ETL_UNALIGNED_TYPE_INCLUDED
48 namespace private_unaligned_type
54 template <
size_t Size_>
59 static ETL_CONSTANT
size_t Size =
Size_;
80 ETL_CONSTEXPR
size_t size()
const
215 unsigned char storage[Size];
218 template <
size_t Size_>
219 ETL_CONSTANT
size_t unaligned_type_common<Size_>::Size;
228 template <
typename T,
int Endian_>
245 static ETL_CONSTANT
int Endian =
Endian_;
266 template <
int Endian_Other>
285 template <
int Endian_Other>
298 return etl::equal(
lhs.data(),
lhs.data() +
lhs.Size,
rhs.data());
346 ETL_CONSTEXPR14
operator T()
const
370 template <
typename U,
size_t Size = sizeof(U)>
377 template <
typename U>
403 template <
typename U>
407 static ETL_CONSTEXPR14
void copy(
T value,
unsigned char*
store)
409 if (Endian == etl::endianness::value())
424 if (Endian == etl::endianness::value())
426 value =
static_cast<T>(
static_cast<unsigned char>(
store[0]));
431 value =
static_cast<T>(
static_cast<unsigned char>(
store[1]));
456 template <
typename U>
459 static ETL_CONSTEXPR14
void copy(
T value,
unsigned char*
store)
461 if (Endian == etl::endianness::value())
480 if (Endian == etl::endianness::value())
482 value =
static_cast<T>(
static_cast<unsigned char>(
store[0]));
489 value =
static_cast<T>(
static_cast<unsigned char>(
store[3]));
520 template <
typename U>
523 static ETL_CONSTEXPR14
void copy(
T value,
unsigned char*
store)
525 if (Endian == etl::endianness::value())
552 if (Endian == etl::endianness::value())
554 value =
static_cast<T>(
static_cast<unsigned char>(
store[0]));
565 value =
static_cast<T>(
static_cast<unsigned char>(
store[7]));
605 template <
typename T,
int Endian_>
608 template <
typename T,
int Endian_>
611#if ETL_HAS_CONSTEXPR_ENDIANNESS
624#if ETL_USING_8BIT_TYPES
632#if ETL_USING_64BIT_TYPES
653#if ETL_USING_8BIT_TYPES
661#if ETL_USING_64BIT_TYPES
681#if ETL_USING_8BIT_TYPES
689#if ETL_USING_64BIT_TYPES
709#if ETL_USING_8BIT_TYPES
717#if ETL_USING_64BIT_TYPES
726 template <
typename T,
int Endian>
731 template <
typename T,
int Endian>
Definition unaligned_type.h:56
ETL_CONSTEXPR14 const_reverse_iterator rend() const
Const reverse iterator to the end of the storage.
Definition unaligned_type.h:184
ETL_CONSTEXPR14 const_reverse_iterator crend() const
Const reverse iterator to the end of the storage.
Definition unaligned_type.h:192
iterator begin()
Iterator to the beginning of the storage.
Definition unaligned_type.h:104
ETL_CONSTEXPR const_pointer data() const
Const pointer to the beginning of the storage.
Definition unaligned_type.h:96
ETL_CONSTEXPR const storage_type & operator[](int i) const
Const index operator.
Definition unaligned_type.h:208
ETL_CONSTEXPR const_iterator end() const
Const iterator to the end of the storage.
Definition unaligned_type.h:160
ETL_CONSTEXPR const_iterator begin() const
Const iterator to the beginning of the storage.
Definition unaligned_type.h:112
storage_type & operator[](int i)
Index operator.
Definition unaligned_type.h:200
ETL_CONSTEXPR const_iterator cbegin() const
Const iterator to the beginning of the storage.
Definition unaligned_type.h:120
ETL_CONSTEXPR14 const_reverse_iterator rbegin() const
Const reverse iterator to the beginning of the storage.
Definition unaligned_type.h:136
reverse_iterator rend()
Reverse iterator to the end of the storage.
Definition unaligned_type.h:176
iterator end()
Iterator to the end of the storage.
Definition unaligned_type.h:152
reverse_iterator rbegin()
Reverse iterator to the beginning of the storage.
Definition unaligned_type.h:128
ETL_CONSTEXPR unaligned_type_common()
Default constructor.
Definition unaligned_type.h:72
pointer data()
Pointer to the beginning of the storage.
Definition unaligned_type.h:88
ETL_CONSTEXPR size_t size() const
Size of the storage.
Definition unaligned_type.h:80
ETL_CONSTEXPR const_iterator cend() const
Const iterator to the end of the storage.
Definition unaligned_type.h:168
ETL_CONSTEXPR14 const_reverse_iterator crbegin() const
Const reverse iterator to the beginning of the storage.
Definition unaligned_type.h:144
Allows an arithmetic type to be stored at an unaligned address.
Definition unaligned_type.h:230
friend ETL_CONSTEXPR14 bool operator!=(const unaligned_type &lhs, T rhs)
Inequality operator.
Definition unaligned_type.h:322
ETL_CONSTEXPR14 unaligned_type & operator=(T value)
Assignment operator.
Definition unaligned_type.h:275
ETL_CONSTEXPR14 unaligned_type(const unaligned_type< T, Endian_Other > &other)
Copy constructor.
Definition unaligned_type.h:267
ETL_CONSTEXPR14 T value() const
Get the value.
Definition unaligned_type.h:358
friend ETL_CONSTEXPR14 bool operator==(const unaligned_type &lhs, const unaligned_type &rhs)
Equality operator.
Definition unaligned_type.h:296
ETL_CONSTEXPR14 unaligned_type(T value)
Construct from a value.
Definition unaligned_type.h:258
ETL_CONSTEXPR unaligned_type()
Default constructor.
Definition unaligned_type.h:251
is_floating_point
Definition type_traits_generator.h:1031
is_integral
Definition type_traits_generator.h:1001
bitset_ext
Definition absolute.h:38
pair holds two objects of arbitrary type
Definition utility.h:164
Unaligned copy.
Definition unaligned_type.h:371