31#ifndef ETL_UNALIGNED_TYPE_INCLUDED
32#define ETL_UNALIGNED_TYPE_INCLUDED
49#if ETL_USING_CPP20 && ETL_USING_STL
61 unaligned_type_exception(string_type reason_, string_type file_name_, numeric_type line_number_)
62 :
exception(reason_, file_name_, line_number_)
70 class unaligned_type_buffer_size :
public unaligned_type_exception
74 unaligned_type_buffer_size(string_type file_name_, numeric_type line_number_)
75 : unaligned_type_exception(ETL_ERROR_TEXT(
"unaligned_type:buffer size", ETL_UNALIGNED_TYPE_FILE_ID
"A"), file_name_, line_number_)
80 namespace private_unaligned_type
88 template <
size_t Size_,
typename TDerivedType>
93 typedef TDerivedType derived_type;
94 typedef unsigned char storage_type;
95 typedef storage_type* pointer;
96 typedef const storage_type* const_pointer;
105 unaligned_type_common() {}
120 return get_storage();
126 const_pointer
data()
const
128 return get_storage();
166 const_reverse_iterator
rbegin()
const
168 return const_reverse_iterator(get_storage() + Size_);
174 const_reverse_iterator
crbegin()
const
176 return const_reverse_iterator(get_storage() + Size_);
184 return iterator(get_storage() + Size_);
214 const_reverse_iterator
rend()
const
216 return const_reverse_iterator(get_storage());
222 const_reverse_iterator
crend()
const
224 return const_reverse_iterator(get_storage());
230 storage_type& operator[](
int i)
232 return get_storage()[i];
238 const storage_type& operator[](
int i)
const
240 return get_storage()[i];
248 pointer get_storage()
250 return static_cast<derived_type*
>(
this)->storage;
256 const_pointer get_storage()
const
258 return static_cast<const derived_type*
>(
this)->storage;
269 template <
size_t Size_>
270 ETL_PACKED_CLASS(unaligned_type_storage)
271 : public unaligned_type_common<Size_, unaligned_type_storage<Size_> >
275 friend class unaligned_type_common<Size_, unaligned_type_storage<Size_> >;
280 unaligned_type_storage()
285 unsigned char storage[Size_];
295 template <
size_t Size_>
297 : public unaligned_type_common<Size_, unaligned_type_storage_ext<Size_> >
301 friend class unaligned_type_common<Size_, unaligned_type_storage_ext<Size_> >;
306 unaligned_type_storage_ext(
unsigned char* storage_)
312 unaligned_type_storage_ext(
const unaligned_type_storage_ext<Size_>& other)
313 : storage(other.storage)
318 unaligned_type_storage_ext& operator=(
const unaligned_type_storage_ext<Size_>& other)
320 storage = other.storage;
325 unsigned char* storage;
332 template <
size_t Size_,
int Endian_,
bool Is_Integral>
339 template <
size_t Size_,
int Endian_>
344 typedef typename private_unaligned_type::unaligned_type_storage< Size_>::storage_type storage_type;
345 typedef typename private_unaligned_type::unaligned_type_storage<Size_>::pointer pointer;
346 typedef typename private_unaligned_type::unaligned_type_storage< Size_>::const_pointer const_pointer;
349 template <
typename T>
350 static void copy_value_to_store(
const T& value, pointer store)
352 memcpy(store, &value, Size_);
354#if ETL_HAS_CONSTEXPR_ENDIANNESS
355 if ETL_IF_CONSTEXPR (Endian_ != etl::endianness::value())
357 if (Endian_ != etl::endianness::value())
360 etl::reverse(store, store + Size_);
365 template <
typename T>
366 static void copy_store_to_value(const_pointer store, T & value)
368 memcpy(&value, store, Size_);
370#if ETL_HAS_CONSTEXPR_ENDIANNESS
371 if ETL_IF_CONSTEXPR (Endian_ != etl::endianness::value())
373 if (Endian_ != etl::endianness::value())
381 static void copy_store_to_store(const_pointer src,
int endian_src, pointer dst)
383 memcpy(dst, src, Size_);
385 if (Endian_ != endian_src)
387 etl::reverse(dst, dst + Size_);
397 template <
size_t Size_,
int Endian_>
402 typedef typename private_unaligned_type::unaligned_type_storage< Size_>::storage_type storage_type;
403 typedef typename private_unaligned_type::unaligned_type_storage<Size_>::pointer pointer;
404 typedef typename private_unaligned_type::unaligned_type_storage< Size_>::const_pointer const_pointer;
407 template <
typename T>
408 static void copy_value_to_store(
const T& value, pointer store)
410 memcpy(store, &value, Size_);
412#if ETL_HAS_CONSTEXPR_ENDIANNESS
413 if ETL_IF_CONSTEXPR (Endian_ != etl::endianness::value())
415 if (Endian_ != etl::endianness::value())
418 etl::reverse(store, store + Size_);
423 template <
typename T>
424 static void copy_store_to_value(const_pointer store, T & value)
426 memcpy(&value, store, Size_);
428#if ETL_HAS_CONSTEXPR_ENDIANNESS
429 if ETL_IF_CONSTEXPR (Endian_ != etl::endianness::value())
431 if (Endian_ != etl::endianness::value())
434 etl::reverse(
reinterpret_cast<pointer
>(&value),
reinterpret_cast<pointer
>(&value) + Size_);
439 static void copy_store_to_store(const_pointer src,
int endian_src, pointer dst)
441 memcpy(dst, src, Size_);
443 if (Endian_ != endian_src)
445 etl::reverse(dst, dst + Size_);
458 template <
typename T,
int Endian_>
459 ETL_PACKED_CLASS(unaligned_type)
460 : public private_unaligned_type::unaligned_type_storage<sizeof(T)>
464 ETL_STATIC_ASSERT(etl::is_integral<T>::value || etl::is_floating_point<T>::value,
"Unaligned type must be integral or floating point");
466 typedef T value_type;
468 typedef private_unaligned_type::unaligned_copy<
sizeof(T), Endian_, etl::is_floating_point<T>::value ?
false : true> unaligned_copy;
470 typedef typename private_unaligned_type::unaligned_type_storage<
sizeof(T)>::storage_type storage_type;
471 typedef typename private_unaligned_type::unaligned_type_storage<
sizeof(T)>::pointer pointer;
472 typedef typename private_unaligned_type::unaligned_type_storage<
sizeof(T)>::const_pointer const_pointer;
473 typedef typename private_unaligned_type::unaligned_type_storage<
sizeof(T)>::iterator iterator;
474 typedef typename private_unaligned_type::unaligned_type_storage<
sizeof(T)>::const_iterator const_iterator;
475 typedef typename private_unaligned_type::unaligned_type_storage<
sizeof(T)>::reverse_iterator reverse_iterator;
476 typedef typename private_unaligned_type::unaligned_type_storage<
sizeof(T)>::const_reverse_iterator const_reverse_iterator;
478 static ETL_CONSTANT
int Endian = Endian_;
479 static ETL_CONSTANT
size_t Size =
sizeof(T);
489 unaligned_type(T value)
491 unaligned_copy::copy_value_to_store(value, this->storage);
497 unaligned_type(
const void* address)
499 etl::copy_n(
reinterpret_cast<const unsigned char*
>(address),
sizeof(T), this->storage);
505 unaligned_type(
const void* address,
size_t buffer_size)
507 ETL_ASSERT(
sizeof(T) <= buffer_size, ETL_ERROR(etl::unaligned_type_buffer_size));
509 etl::copy_n(
reinterpret_cast<const unsigned char*
>(address),
sizeof(T), this->storage);
515 unaligned_type(
const unaligned_type<T, Endian>& other)
517 unaligned_copy::copy_store_to_store(other.data(),
Endian, this->storage);
523 template <
int Endian_Other>
524 unaligned_type(
const unaligned_type<T, Endian_Other>& other)
526 unaligned_copy::copy_store_to_store(other.data(), Endian_Other, this->storage);
532 unaligned_type& operator=(T value)
534 unaligned_copy::copy_value_to_store(value, this->storage);
542 unaligned_type& operator=(
const unaligned_type<T, Endian_>& other)
544 unaligned_copy::copy_store_to_store(other.data(), Endian_, this->storage);
552 template <
int Endian_Other>
553 unaligned_type& operator=(
const unaligned_type<T, Endian_Other>& other)
555 unaligned_copy::copy_store_to_store(other.data(), Endian_Other, this->storage);
567 unaligned_copy::copy_store_to_value(this->storage, value);
579 unaligned_copy::copy_store_to_value(this->storage, value);
586 template <
typename T,
int Endian_>
587 ETL_CONSTANT
int unaligned_type<T, Endian_>::Endian;
589 template <
typename T,
int Endian_>
590 ETL_CONSTANT
size_t unaligned_type<T, Endian_>::Size;
599 template <
typename T,
int Endian_>
600 ETL_PACKED_CLASS(unaligned_type_ext)
601 : public private_unaligned_type::unaligned_type_storage_ext<sizeof(T)>
605 ETL_STATIC_ASSERT(etl::is_integral<T>::value || etl::is_floating_point<T>::value,
"Unaligned type must be integral or floating point");
607 template <
typename U,
int Endian_Other>
608 friend class unaligned_type_ext;
614 typedef typename private_unaligned_type::unaligned_type_storage_ext<
sizeof(T)>::storage_type storage_type;
615 typedef typename private_unaligned_type::unaligned_type_storage_ext<
sizeof(T)>
::pointer pointer;
616 typedef typename private_unaligned_type::unaligned_type_storage_ext<
sizeof(T)>::const_pointer const_pointer;
617 typedef typename private_unaligned_type::unaligned_type_storage_ext<
sizeof(T)>
::iterator iterator;
620 typedef typename private_unaligned_type::unaligned_type_storage_ext<
sizeof(T)>::const_reverse_iterator const_reverse_iterator;
622 static ETL_CONSTANT
int Endian = Endian_;
623 static ETL_CONSTANT
size_t Size =
sizeof(T);
628 unaligned_type_ext(
pointer storage_)
629 : private_unaligned_type::unaligned_type_storage_ext<Size>(storage_)
636 unaligned_type_ext(T value,
pointer storage_)
637 : private_unaligned_type::unaligned_type_storage_ext<Size>(storage_)
639 unaligned_copy::copy_value_to_store(value, this->storage);
645 template <
int Endian_Other>
646 unaligned_type_ext(
const unaligned_type_ext<T, Endian_Other>& other,
pointer storage_)
647 : private_unaligned_type::unaligned_type_storage_ext<Size>(storage_)
649 unaligned_copy::copy_store_to_store(other.data(), Endian_Other, this->storage);
656 unaligned_type_ext(unaligned_type_ext<T, Endian> && other)
657 : private_unaligned_type::unaligned_type_storage_ext<Size>(other.storage)
659 other.storage = ETL_NULLPTR;
665 template <
int Endian_Other>
666 unaligned_type_ext(unaligned_type_ext<T, Endian_Other> && other)
667 : private_unaligned_type::unaligned_type_storage_ext<Size>(other.storage)
671 if (
Endian != Endian_Other)
673 etl::reverse(this->
begin(), this->
end());
676 other.storage = ETL_NULLPTR;
683 unaligned_type_ext& operator=(T value)
685 unaligned_copy::copy_value_to_store(value, this->storage);
693 unaligned_type_ext& operator=(
const unaligned_type_ext<T, Endian>& other)
695 unaligned_copy::copy_store_to_store(other.data(),
Endian, this->storage);
703 template <
int Endian_Other>
704 unaligned_type_ext& operator=(
const unaligned_type_ext<T, Endian_Other>& other)
706 unaligned_copy::copy_store_to_store(other.data(), Endian_Other, this->storage);
715 unaligned_type_ext& operator=(unaligned_type_ext<T, Endian>&& other)
717 this->storage = other.storage;
718 other.storage = ETL_NULLPTR;
726 template <
int Endian_Other>
727 unaligned_type_ext& operator=(unaligned_type_ext<T, Endian_Other>&& other)
729 this->storage = other.storage;
733 if (
Endian != Endian_Other)
735 etl::reverse(this->
begin(), this->
end());
738 other.storage = ETL_NULLPTR;
751 unaligned_copy::copy_store_to_value(this->storage, value);
763 unaligned_copy::copy_store_to_value(this->storage, value);
771 void set_storage(
pointer storage_)
773 this->storage = storage_;
778 unaligned_type_ext() ETL_DELETE;
782 template <
typename T,
int Endian_>
783 ETL_CONSTANT
int unaligned_type_ext<T, Endian_>::Endian;
785 template <
typename T,
int Endian_>
786 ETL_CONSTANT
size_t unaligned_type_ext<T, Endian_>::Size;
788#if ETL_HAS_CONSTEXPR_ENDIANNESS
790 typedef unaligned_type<char, etl::endianness::value()> host_char_t;
791 typedef unaligned_type<
signed char, etl::endianness::value()> host_schar_t;
792 typedef unaligned_type<
unsigned char, etl::endianness::value()> host_uchar_t;
793 typedef unaligned_type<short, etl::endianness::value()> host_short_t;
794 typedef unaligned_type<
unsigned short, etl::endianness::value()> host_ushort_t;
795 typedef unaligned_type<int, etl::endianness::value()> host_int_t;
796 typedef unaligned_type<
unsigned int, etl::endianness::value()> host_uint_t;
797 typedef unaligned_type<long, etl::endianness::value()> host_long_t;
798 typedef unaligned_type<
unsigned long, etl::endianness::value()> host_ulong_t;
799 typedef unaligned_type<
long long, etl::endianness::value()> host_long_long_t;
800 typedef unaligned_type<
unsigned long long, etl::endianness::value()> host_ulong_long_t;
801 #if ETL_USING_8BIT_TYPES
802 typedef unaligned_type<int8_t, etl::endianness::value()> host_int8_t;
803 typedef unaligned_type<uint8_t, etl::endianness::value()> host_uint8_t;
805 typedef unaligned_type<int16_t, etl::endianness::value()> host_int16_t;
806 typedef unaligned_type<uint16_t, etl::endianness::value()> host_uint16_t;
807 typedef unaligned_type<int32_t, etl::endianness::value()> host_int32_t;
808 typedef unaligned_type<uint32_t, etl::endianness::value()> host_uint32_t;
809 #if ETL_USING_64BIT_TYPES
810 typedef unaligned_type<int64_t, etl::endianness::value()> host_int64_t;
811 typedef unaligned_type<uint64_t, etl::endianness::value()> host_uint64_t;
813 typedef unaligned_type<float, etl::endianness::value()> host_float_t;
814 typedef unaligned_type<double, etl::endianness::value()> host_double_t;
815 typedef unaligned_type<
long double, etl::endianness::value()> host_long_double_t;
819 typedef unaligned_type<char, etl::endian::little> le_char_t;
820 typedef unaligned_type<signed char, etl::endian::little> le_schar_t;
821 typedef unaligned_type<unsigned char, etl::endian::little> le_uchar_t;
822 typedef unaligned_type<short, etl::endian::little> le_short_t;
823 typedef unaligned_type<unsigned short, etl::endian::little> le_ushort_t;
824 typedef unaligned_type<int, etl::endian::little> le_int_t;
825 typedef unaligned_type<unsigned int, etl::endian::little> le_uint_t;
826 typedef unaligned_type<long, etl::endian::little> le_long_t;
827 typedef unaligned_type<unsigned long, etl::endian::little> le_ulong_t;
828 typedef unaligned_type<long long, etl::endian::little> le_long_long_t;
829 typedef unaligned_type<unsigned long long, etl::endian::little> le_ulong_long_t;
830#if ETL_USING_8BIT_TYPES
831 typedef unaligned_type<int8_t, etl::endian::little> le_int8_t;
832 typedef unaligned_type<uint8_t, etl::endian::little> le_uint8_t;
834 typedef unaligned_type<int16_t, etl::endian::little> le_int16_t;
835 typedef unaligned_type<uint16_t, etl::endian::little> le_uint16_t;
836 typedef unaligned_type<int32_t, etl::endian::little> le_int32_t;
837 typedef unaligned_type<uint32_t, etl::endian::little> le_uint32_t;
838#if ETL_USING_64BIT_TYPES
839 typedef unaligned_type<int64_t, etl::endian::little> le_int64_t;
840 typedef unaligned_type<uint64_t, etl::endian::little> le_uint64_t;
842 typedef unaligned_type<float, etl::endian::little> le_float_t;
843 typedef unaligned_type<double, etl::endian::little> le_double_t;
844 typedef unaligned_type<long double, etl::endian::little> le_long_double_t;
847 typedef unaligned_type<char, etl::endian::big> be_char_t;
848 typedef unaligned_type<signed char, etl::endian::big> be_schar_t;
849 typedef unaligned_type<unsigned char, etl::endian::big> be_uchar_t;
850 typedef unaligned_type<short, etl::endian::big> be_short_t;
851 typedef unaligned_type<unsigned short, etl::endian::big> be_ushort_t;
852 typedef unaligned_type<int, etl::endian::big> be_int_t;
853 typedef unaligned_type<unsigned int, etl::endian::big> be_uint_t;
854 typedef unaligned_type<long, etl::endian::big> be_long_t;
855 typedef unaligned_type<unsigned long, etl::endian::big> be_ulong_t;
856 typedef unaligned_type<long long, etl::endian::big> be_long_long_t;
857 typedef unaligned_type<unsigned long long, etl::endian::big> be_ulong_long_t;
858#if ETL_USING_8BIT_TYPES
859 typedef unaligned_type<int8_t, etl::endian::big> be_int8_t;
860 typedef unaligned_type<uint8_t, etl::endian::big> be_uint8_t;
862 typedef unaligned_type<int16_t, etl::endian::big> be_int16_t;
863 typedef unaligned_type<uint16_t, etl::endian::big> be_uint16_t;
864 typedef unaligned_type<int32_t, etl::endian::big> be_int32_t;
865 typedef unaligned_type<uint32_t, etl::endian::big> be_uint32_t;
866#if ETL_USING_64BIT_TYPES
867 typedef unaligned_type<int64_t, etl::endian::big> be_int64_t;
868 typedef unaligned_type<uint64_t, etl::endian::big> be_uint64_t;
870 typedef unaligned_type<float, etl::endian::big> be_float_t;
871 typedef unaligned_type<double, etl::endian::big> be_double_t;
872 typedef unaligned_type<long double, etl::endian::big> be_long_double_t;
875 typedef be_char_t net_char_t;
876 typedef be_schar_t net_schar_t;
877 typedef be_uchar_t net_uchar_t;
878 typedef be_short_t net_short_t;
879 typedef be_ushort_t net_ushort_t;
880 typedef be_int_t net_int_t;
881 typedef be_uint_t net_uint_t;
882 typedef be_long_t net_long_t;
883 typedef be_ulong_t net_ulong_t;
884 typedef be_long_long_t net_long_long_t;
885 typedef be_ulong_long_t net_ulong_long_t;
886#if ETL_USING_8BIT_TYPES
887 typedef be_int8_t net_int8_t;
888 typedef be_uint8_t net_uint8_t;
890 typedef be_int16_t net_int16_t;
891 typedef be_uint16_t net_uint16_t;
892 typedef be_int32_t net_int32_t;
893 typedef be_uint32_t net_uint32_t;
894#if ETL_USING_64BIT_TYPES
895 typedef be_int64_t net_int64_t;
896 typedef be_uint64_t net_uint64_t;
898 typedef be_float_t net_float_t;
899 typedef be_double_t net_double_t;
900 typedef be_long_double_t net_long_double_t;
903 template <
typename T,
int Endian>
904 using unaligned_type_t =
typename etl::unaligned_type<T, Endian>::type;
908 template <
typename T,
int Endian>
909 constexpr size_t unaligned_type_v = etl::unaligned_type<T, Endian>::Size;
912#if ETL_HAS_CONSTEXPR_ENDIANNESS
914 typedef unaligned_type_ext<char, etl::endianness::value()> host_char_ext_t;
915 typedef unaligned_type_ext<
signed char, etl::endianness::value()> host_schar_ext_t;
916 typedef unaligned_type_ext<
unsigned char, etl::endianness::value()> host_uchar_ext_t;
917 typedef unaligned_type_ext<short, etl::endianness::value()> host_short_ext_t;
918 typedef unaligned_type_ext<
unsigned short, etl::endianness::value()> host_ushort_ext_t;
919 typedef unaligned_type_ext<int, etl::endianness::value()> host_int_ext_t;
920 typedef unaligned_type_ext<
unsigned int, etl::endianness::value()> host_uint_ext_t;
921 typedef unaligned_type_ext<long, etl::endianness::value()> host_long_ext_t;
922 typedef unaligned_type_ext<
unsigned long, etl::endianness::value()> host_ulong_ext_t;
923 typedef unaligned_type_ext<
long long, etl::endianness::value()> host_long_long_ext_t;
924 typedef unaligned_type_ext<
unsigned long long, etl::endianness::value()> host_ulong_long_ext_t;
925 #if ETL_USING_8BIT_TYPES
926 typedef unaligned_type_ext<int8_t, etl::endianness::value()> host_int8_ext_t;
927 typedef unaligned_type_ext<uint8_t, etl::endianness::value()> host_uint8_ext_t;
929 typedef unaligned_type_ext<int16_t, etl::endianness::value()> host_int16_ext_t;
930 typedef unaligned_type_ext<uint16_t, etl::endianness::value()> host_uint16_ext_t;
931 typedef unaligned_type_ext<int32_t, etl::endianness::value()> host_int32_ext_t;
932 typedef unaligned_type_ext<uint32_t, etl::endianness::value()> host_uint32_ext_t;
933 #if ETL_USING_64BIT_TYPES
934 typedef unaligned_type_ext<int64_t, etl::endianness::value()> host_int64_ext_t;
935 typedef unaligned_type_ext<uint64_t, etl::endianness::value()> host_uint64_ext_t;
937 typedef unaligned_type_ext<float, etl::endianness::value()> host_float_ext_t;
938 typedef unaligned_type_ext<double, etl::endianness::value()> host_double_ext_t;
939 typedef unaligned_type_ext<
long double, etl::endianness::value()> host_long_double_ext_t;
943 typedef unaligned_type_ext<char, etl::endian::little> le_char_ext_t;
944 typedef unaligned_type_ext<signed char, etl::endian::little> le_schar_ext_t;
945 typedef unaligned_type_ext<unsigned char, etl::endian::little> le_uchar_ext_t;
946 typedef unaligned_type_ext<short, etl::endian::little> le_short_ext_t;
947 typedef unaligned_type_ext<unsigned short, etl::endian::little> le_ushort_ext_t;
948 typedef unaligned_type_ext<int, etl::endian::little> le_int_ext_t;
949 typedef unaligned_type_ext<unsigned int, etl::endian::little> le_uint_ext_t;
950 typedef unaligned_type_ext<long, etl::endian::little> le_long_ext_t;
951 typedef unaligned_type_ext<unsigned long, etl::endian::little> le_ulong_ext_t;
952 typedef unaligned_type_ext<long long, etl::endian::little> le_long_long_ext_t;
953 typedef unaligned_type_ext<unsigned long long, etl::endian::little> le_ulong_long_ext_t;
954#if ETL_USING_8BIT_TYPES
955 typedef unaligned_type_ext<int8_t, etl::endian::little> le_int8_ext_t;
956 typedef unaligned_type_ext<uint8_t, etl::endian::little> le_uint8_ext_t;
958 typedef unaligned_type_ext<int16_t, etl::endian::little> le_int16_ext_t;
959 typedef unaligned_type_ext<uint16_t, etl::endian::little> le_uint16_ext_t;
960 typedef unaligned_type_ext<int32_t, etl::endian::little> le_int32_ext_t;
961 typedef unaligned_type_ext<uint32_t, etl::endian::little> le_uint32_ext_t;
962#if ETL_USING_64BIT_TYPES
963 typedef unaligned_type_ext<int64_t, etl::endian::little> le_int64_ext_t;
964 typedef unaligned_type_ext<uint64_t, etl::endian::little> le_uint64_ext_t;
966 typedef unaligned_type_ext<float, etl::endian::little> le_float_ext_t;
967 typedef unaligned_type_ext<double, etl::endian::little> le_double_ext_t;
968 typedef unaligned_type_ext<long double, etl::endian::little> le_long_double_ext_t;
971 typedef unaligned_type_ext<char, etl::endian::big> be_char_ext_t;
972 typedef unaligned_type_ext<signed char, etl::endian::big> be_schar_ext_t;
973 typedef unaligned_type_ext<unsigned char, etl::endian::big> be_uchar_ext_t;
974 typedef unaligned_type_ext<short, etl::endian::big> be_short_ext_t;
975 typedef unaligned_type_ext<unsigned short, etl::endian::big> be_ushort_ext_t;
976 typedef unaligned_type_ext<int, etl::endian::big> be_int_ext_t;
977 typedef unaligned_type_ext<unsigned int, etl::endian::big> be_uint_ext_t;
978 typedef unaligned_type_ext<long, etl::endian::big> be_long_ext_t;
979 typedef unaligned_type_ext<unsigned long, etl::endian::big> be_ulong_ext_t;
980 typedef unaligned_type_ext<long long, etl::endian::big> be_long_long_ext_t;
981 typedef unaligned_type_ext<unsigned long long, etl::endian::big> be_ulong_long_ext_t;
982#if ETL_USING_8BIT_TYPES
983 typedef unaligned_type_ext<int8_t, etl::endian::big> be_int8_ext_t;
984 typedef unaligned_type_ext<uint8_t, etl::endian::big> be_uint8_ext_t;
986 typedef unaligned_type_ext<int16_t, etl::endian::big> be_int16_ext_t;
987 typedef unaligned_type_ext<uint16_t, etl::endian::big> be_uint16_ext_t;
988 typedef unaligned_type_ext<int32_t, etl::endian::big> be_int32_ext_t;
989 typedef unaligned_type_ext<uint32_t, etl::endian::big> be_uint32_ext_t;
990#if ETL_USING_64BIT_TYPES
991 typedef unaligned_type_ext<int64_t, etl::endian::big> be_int64_ext_t;
992 typedef unaligned_type_ext<uint64_t, etl::endian::big> be_uint64_ext_t;
994 typedef unaligned_type_ext<float, etl::endian::big> be_float_ext_t;
995 typedef unaligned_type_ext<double, etl::endian::big> be_double_ext_t;
996 typedef unaligned_type_ext<long double, etl::endian::big> be_long_double_ext_t;
999 typedef be_char_ext_t net_char_ext_t;
1000 typedef be_schar_ext_t net_schar_ext_t;
1001 typedef be_uchar_ext_t net_uchar_ext_t;
1002 typedef be_short_ext_t net_short_ext_t;
1003 typedef be_ushort_ext_t net_ushort_ext_t;
1004 typedef be_int_ext_t net_int_ext_t;
1005 typedef be_uint_ext_t net_uint_ext_t;
1006 typedef be_long_ext_t net_long_ext_t;
1007 typedef be_ulong_ext_t net_ulong_ext_t;
1008 typedef be_long_long_ext_t net_long_long_ext_t;
1009 typedef be_ulong_long_ext_t net_ulong_long_ext_t;
1010#if ETL_USING_8BIT_TYPES
1011 typedef be_int8_ext_t net_int8_ext_t;
1012 typedef be_uint8_ext_t net_uint8_ext_t;
1014 typedef be_int16_ext_t net_int16_ext_t;
1015 typedef be_uint16_ext_t net_uint16_ext_t;
1016 typedef be_int32_ext_t net_int32_ext_t;
1017 typedef be_uint32_ext_t net_uint32_ext_t;
1018#if ETL_USING_64BIT_TYPES
1019 typedef be_int64_ext_t net_int64_ext_t;
1020 typedef be_uint64_ext_t net_uint64_ext_t;
1022 typedef be_float_ext_t net_float_ext_t;
1023 typedef be_double_ext_t net_double_ext_t;
1024 typedef be_long_double_ext_t net_long_double_ext_t;
1027 template <
typename T,
int Endian>
1028 using unaligned_type_ext_t =
typename etl::unaligned_type_ext<T, Endian>::type;
1032 template <
typename T,
int Endian>
1033 constexpr size_t unaligned_type_ext_t_v = etl::unaligned_type_ext<T, Endian>::Size;
Unaligned copy.
Definition unaligned_type.h:333
Definition iterator.h:252
ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value &&etl::is_unsigned< T >::value &&(etl::integral_limits< T >::bits==16U), T >::type reverse_bytes(T value)
Definition binary.h:745
#define ETL_ASSERT(b, e)
Definition error_handler.h:511
ETL_EXCEPTION_CONSTEXPR exception(string_type reason_, string_type, numeric_type)
Constructor.
Definition exception.h:81
Definition exception.h:59
bitset_ext
Definition absolute.h:40
ETL_CONSTEXPR TContainer::reverse_iterator rend(TContainer &container)
Definition iterator.h:1119
ETL_CONSTEXPR TContainer::pointer data(TContainer &container)
Definition iterator.h:1228
ETL_CONSTEXPR TContainer::const_reverse_iterator crbegin(const TContainer &container)
Definition iterator.h:1109
ETL_CONSTEXPR TContainer::reverse_iterator rbegin(TContainer &container)
Definition iterator.h:1089
ETL_CONSTEXPR TContainer::const_iterator cbegin(const TContainer &container)
Definition iterator.h:987
ETL_CONSTEXPR TContainer::size_type size(const TContainer &container)
Definition iterator.h:1192
ETL_CONSTEXPR TContainer::iterator begin(TContainer &container)
Definition iterator.h:967
ETL_PACKED_CLASS(unaligned_type) ETL_END_PACKED ETL_CONSTANT int unaligned_type< T, Endian_ >::Endian
Allows an arithmetic type to be stored at an unaligned address.
Definition unaligned_type.h:459
ETL_CONSTEXPR TContainer::const_reverse_iterator crend(const TContainer &container)
Definition iterator.h:1139
ETL_CONSTEXPR TContainer::const_iterator cend(const TContainer &container)
Definition iterator.h:1017
ETL_CONSTEXPR TContainer::iterator end(TContainer &container)
Definition iterator.h:997
iterator
Definition iterator.h:424
ETL_PACKED_CLASS(unaligned_type_common)
Definition unaligned_type.h:89