31#ifndef ETL_UNALIGNED_TYPE_INCLUDED
32#define ETL_UNALIGNED_TYPE_INCLUDED
49 namespace private_unaligned_type
55 template <
size_t Size_>
60 static ETL_CONSTANT
size_t Size =
Size_;
81 ETL_CONSTEXPR
size_t size()
const
216 unsigned char storage[Size];
219 template <
size_t Size_>
220 ETL_CONSTANT
size_t unaligned_type_common<Size_>::Size;
229 template <
typename T,
int Endian_>
246 static ETL_CONSTANT
int Endian =
Endian_;
267 template <
int Endian_Other>
286 template <
int Endian_Other>
297 ETL_CONSTEXPR14
operator T()
const
321 template <
typename U,
size_t Size = sizeof(U),
typename Enable =
void>
328 template <
typename U>
354 template <
typename U>
358 static ETL_CONSTEXPR14
void copy(
T value,
unsigned char*
store)
360 if (Endian == etl::endianness::value())
375 if (Endian == etl::endianness::value())
377 value =
static_cast<T>(
static_cast<unsigned char>(
store[0]));
382 value =
static_cast<T>(
static_cast<unsigned char>(
store[1]));
408 template <
typename U>
411 static ETL_CONSTEXPR14
void copy(
T value,
unsigned char*
store)
413 if (Endian == etl::endianness::value())
432 if (Endian == etl::endianness::value())
434 value =
static_cast<T>(
static_cast<unsigned char>(
store[0]));
441 value =
static_cast<T>(
static_cast<unsigned char>(
store[3]));
473 template <
typename U>
480 if (Endian != etl::endianness::value())
489 unsigned char temp[4U];
492 if (Endian != etl::endianness::value())
507 etl::reverse(
dst,
dst + 4U);
517 template <
typename U>
520 static ETL_CONSTEXPR14
void copy(
T value,
unsigned char*
store)
522 if (Endian == etl::endianness::value())
549 if (Endian == etl::endianness::value())
551 value =
static_cast<T>(
static_cast<unsigned char>(
store[0]));
562 value =
static_cast<T>(
static_cast<unsigned char>(
store[7]));
606 template <
typename U>
613 if (Endian != etl::endianness::value())
622 unsigned char temp[8U];
625 if (Endian != etl::endianness::value())
640 etl::reverse(
dst,
dst + 8U);
650 template <
typename U>
657 if (Endian != etl::endianness::value())
666 unsigned char temp[12U];
669 if (Endian != etl::endianness::value())
684 etl::reverse(
dst,
dst + 12U);
694 template <
typename U>
701 if (Endian != etl::endianness::value())
710 unsigned char temp[16U];
713 if (Endian != etl::endianness::value())
728 etl::reverse(
dst,
dst + 16U);
734 template <
typename T,
int Endian_>
737 template <
typename T,
int Endian_>
740#if ETL_HAS_CONSTEXPR_ENDIANNESS
753#if ETL_USING_8BIT_TYPES
761#if ETL_USING_64BIT_TYPES
782#if ETL_USING_8BIT_TYPES
790#if ETL_USING_64BIT_TYPES
810#if ETL_USING_8BIT_TYPES
818#if ETL_USING_64BIT_TYPES
838#if ETL_USING_8BIT_TYPES
846#if ETL_USING_64BIT_TYPES
855 template <
typename T,
int Endian>
860 template <
typename T,
int Endian>
Definition unaligned_type.h:57
ETL_CONSTEXPR14 const_reverse_iterator rend() const
Const reverse iterator to the end of the storage.
Definition unaligned_type.h:185
ETL_CONSTEXPR14 const_reverse_iterator crend() const
Const reverse iterator to the end of the storage.
Definition unaligned_type.h:193
iterator begin()
Iterator to the beginning of the storage.
Definition unaligned_type.h:105
ETL_CONSTEXPR const_pointer data() const
Const pointer to the beginning of the storage.
Definition unaligned_type.h:97
ETL_CONSTEXPR const storage_type & operator[](int i) const
Const index operator.
Definition unaligned_type.h:209
ETL_CONSTEXPR const_iterator end() const
Const iterator to the end of the storage.
Definition unaligned_type.h:161
ETL_CONSTEXPR const_iterator begin() const
Const iterator to the beginning of the storage.
Definition unaligned_type.h:113
storage_type & operator[](int i)
Index operator.
Definition unaligned_type.h:201
ETL_CONSTEXPR const_iterator cbegin() const
Const iterator to the beginning of the storage.
Definition unaligned_type.h:121
ETL_CONSTEXPR14 const_reverse_iterator rbegin() const
Const reverse iterator to the beginning of the storage.
Definition unaligned_type.h:137
reverse_iterator rend()
Reverse iterator to the end of the storage.
Definition unaligned_type.h:177
iterator end()
Iterator to the end of the storage.
Definition unaligned_type.h:153
reverse_iterator rbegin()
Reverse iterator to the beginning of the storage.
Definition unaligned_type.h:129
ETL_CONSTEXPR unaligned_type_common()
Default constructor.
Definition unaligned_type.h:73
pointer data()
Pointer to the beginning of the storage.
Definition unaligned_type.h:89
ETL_CONSTEXPR size_t size() const
Size of the storage.
Definition unaligned_type.h:81
ETL_CONSTEXPR const_iterator cend() const
Const iterator to the end of the storage.
Definition unaligned_type.h:169
ETL_CONSTEXPR14 const_reverse_iterator crbegin() const
Const reverse iterator to the beginning of the storage.
Definition unaligned_type.h:145
Allows an arithmetic type to be stored at an unaligned address.
Definition unaligned_type.h:231
ETL_CONSTEXPR14 unaligned_type & operator=(T value)
Assignment operator.
Definition unaligned_type.h:276
ETL_CONSTEXPR14 unaligned_type(const unaligned_type< T, Endian_Other > &other)
Copy constructor.
Definition unaligned_type.h:268
ETL_CONSTEXPR14 T value() const
Get the value.
Definition unaligned_type.h:309
ETL_CONSTEXPR14 unaligned_type(T value)
Construct from a value.
Definition unaligned_type.h:259
ETL_CONSTEXPR unaligned_type()
Default constructor.
Definition unaligned_type.h:252
enable_if
Definition type_traits_generator.h:1191
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:322