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
87 template <
size_t Size_,
typename TDerivedType>
92 typedef TDerivedType derived_type;
93 typedef unsigned char storage_type;
94 typedef storage_type* pointer;
95 typedef const storage_type* const_pointer;
104 unaligned_type_common()
121 return get_storage();
127 const_pointer data()
const
129 return get_storage();
167 const_reverse_iterator
rbegin()
const
169 return const_reverse_iterator(get_storage() + Size_);
175 const_reverse_iterator
crbegin()
const
177 return const_reverse_iterator(get_storage() + Size_);
185 return iterator(get_storage() + Size_);
215 const_reverse_iterator
rend()
const
217 return const_reverse_iterator(get_storage());
223 const_reverse_iterator
crend()
const
225 return const_reverse_iterator(get_storage());
231 storage_type& operator[](
int i)
233 return get_storage()[i];
239 const storage_type& operator[](
int i)
const
241 return get_storage()[i];
249 pointer get_storage()
251 return static_cast<derived_type*
>(
this)->storage;
257 const_pointer get_storage()
const
259 return static_cast<const derived_type*
>(
this)->storage;
268 template <
size_t Size_>
269 ETL_PACKED_CLASS(unaligned_type_storage) : public unaligned_type_common<Size_, unaligned_type_storage<Size_> >
273 friend class unaligned_type_common<Size_, unaligned_type_storage<Size_> >;
278 unaligned_type_storage()
283 unsigned char storage[Size_];
291 template <
size_t Size_>
292 ETL_PACKED_CLASS(unaligned_type_storage_ext) : public unaligned_type_common<Size_, unaligned_type_storage_ext<Size_> >
296 friend class unaligned_type_common<Size_, unaligned_type_storage_ext<Size_> >;
301 unaligned_type_storage_ext(
unsigned char* storage_)
307 unaligned_type_storage_ext(
const unaligned_type_storage_ext<Size_>& other)
308 : storage(other.storage)
313 unaligned_type_storage_ext& operator =(
const unaligned_type_storage_ext<Size_>& other)
315 storage = other.storage;
320 unsigned char* storage;
326 template <
size_t Size_,
int Endian_,
bool Is_Integral>
333 template <
size_t Size_,
int Endian_>
338 typedef typename private_unaligned_type::unaligned_type_storage<Size_>::storage_type storage_type;
339 typedef typename private_unaligned_type::unaligned_type_storage<Size_>::pointer pointer;
340 typedef typename private_unaligned_type::unaligned_type_storage<Size_>::const_pointer const_pointer;
343 template <
typename T>
344 static void copy_value_to_store(
const T& value, pointer store)
346 memcpy(store, &value, Size_);
348#if ETL_HAS_CONSTEXPR_ENDIANESS
349 if ETL_IF_CONSTEXPR(Endian_ == etl::endianness::value())
351 if (Endian_ != etl::endianness::value())
354 etl::reverse(store, store + Size_);
359 template <
typename T>
360 static void copy_store_to_value(const_pointer store, T& value)
362 memcpy(&value, store, Size_);
364#if ETL_HAS_CONSTEXPR_ENDIANESS
365 if ETL_IF_CONSTEXPR(
Endian == etl::endianness::value())
367 if (Endian_ != etl::endianness::value())
375 static void copy_store_to_store(const_pointer src,
int endian_src, pointer dst)
377 memcpy(dst, src, Size_);
379 if (Endian_ != endian_src)
381 etl::reverse(dst, dst + Size_);
390 template <
size_t Size_,
int Endian_>
395 typedef typename private_unaligned_type::unaligned_type_storage<Size_>::storage_type storage_type;
396 typedef typename private_unaligned_type::unaligned_type_storage<Size_>::pointer pointer;
397 typedef typename private_unaligned_type::unaligned_type_storage<Size_>::const_pointer const_pointer;
400 template <
typename T>
401 static void copy_value_to_store(
const T& value, pointer store)
403 memcpy(store, &value, Size_);
405#if ETL_HAS_CONSTEXPR_ENDIANESS
406 if ETL_IF_CONSTEXPR(Endian_ == etl::endianness::value())
408 if (Endian_ != etl::endianness::value())
411 etl::reverse(store, store + Size_);
416 template <
typename T>
417 static void copy_store_to_value(const_pointer store, T& value)
419 memcpy(&value, store, Size_);
421#if ETL_HAS_CONSTEXPR_ENDIANESS
422 if ETL_IF_CONSTEXPR(
Endian == etl::endianness::value())
424 if (Endian_ != etl::endianness::value())
427 etl::reverse(
reinterpret_cast<pointer
>(&value),
reinterpret_cast<pointer
>(&value) + Size_);
432 static void copy_store_to_store(const_pointer src,
int endian_src, pointer dst)
434 memcpy(dst, src, Size_);
436 if (Endian_ != endian_src)
438 etl::reverse(dst, dst + Size_);
450 template <
typename T,
int Endian_>
451 ETL_PACKED_CLASS(unaligned_type) : public private_unaligned_type::unaligned_type_storage<sizeof(T)>
457 typedef T value_type;
461 typedef typename private_unaligned_type::unaligned_type_storage<
sizeof(T)>::storage_type storage_type;
462 typedef typename private_unaligned_type::unaligned_type_storage<
sizeof(T)>::pointer pointer;
463 typedef typename private_unaligned_type::unaligned_type_storage<
sizeof(T)>::const_pointer const_pointer;
464 typedef typename private_unaligned_type::unaligned_type_storage<
sizeof(T)>::iterator iterator;
465 typedef typename private_unaligned_type::unaligned_type_storage<
sizeof(T)>::const_iterator const_iterator;
466 typedef typename private_unaligned_type::unaligned_type_storage<
sizeof(T)>::reverse_iterator reverse_iterator;
467 typedef typename private_unaligned_type::unaligned_type_storage<
sizeof(T)>::const_reverse_iterator const_reverse_iterator;
469 static ETL_CONSTANT
int Endian = Endian_;
470 static ETL_CONSTANT
size_t Size =
sizeof(T);
482 unaligned_type(T value)
484 unaligned_copy::copy_value_to_store(value, this->storage);
490 unaligned_type(
const void* address)
492 etl::copy_n(
reinterpret_cast<const char*
>(address),
sizeof(T), this->storage);
498 unaligned_type(
const void* address,
size_t buffer_size)
500 ETL_ASSERT(
sizeof(T) <= buffer_size, ETL_ERROR(etl::unaligned_type_buffer_size));
502 etl::copy_n(
reinterpret_cast<const char*
>(address),
sizeof(T), this->storage);
508 unaligned_type(
const unaligned_type<T, Endian>& other)
510 unaligned_copy::copy_store_to_store(other.data(),
Endian, this->storage);
516 template <
int Endian_Other>
517 unaligned_type(
const unaligned_type<T, Endian_Other>& other)
519 unaligned_copy::copy_store_to_store(other.data(), Endian_Other, this->storage);
525 unaligned_type& operator =(T value)
527 unaligned_copy::copy_value_to_store(value, this->storage);
535 unaligned_type& operator =(
const unaligned_type<T, Endian_>& other)
537 unaligned_copy::copy_store_to_store(other.data(), Endian_, this->storage);
545 template <
int Endian_Other>
546 unaligned_type& operator =(
const unaligned_type<T, Endian_Other>& other)
548 unaligned_copy::copy_store_to_store(other.data(), Endian_Other, this->storage);
560 unaligned_copy::copy_store_to_value(this->storage, value);
572 unaligned_copy::copy_store_to_value(this->storage, value);
578 template <
typename T,
int Endian_>
579 ETL_CONSTANT
int unaligned_type<T, Endian_>::Endian;
581 template <
typename T,
int Endian_>
582 ETL_CONSTANT
size_t unaligned_type<T, Endian_>::Size;
591 template <
typename T,
int Endian_>
592 ETL_PACKED_CLASS(unaligned_type_ext) : public private_unaligned_type::unaligned_type_storage_ext<sizeof(T)>
598 template <
typename U,
int Endian_Other>
599 friend class unaligned_type_ext;
605 typedef typename private_unaligned_type::unaligned_type_storage_ext<
sizeof(T)>::storage_type storage_type;
606 typedef typename private_unaligned_type::unaligned_type_storage_ext<
sizeof(T)>
::pointer pointer;
607 typedef typename private_unaligned_type::unaligned_type_storage_ext<
sizeof(T)>::const_pointer const_pointer;
608 typedef typename private_unaligned_type::unaligned_type_storage_ext<
sizeof(T)>
::iterator iterator;
611 typedef typename private_unaligned_type::unaligned_type_storage_ext<
sizeof(T)>::const_reverse_iterator const_reverse_iterator;
613 static ETL_CONSTANT
int Endian = Endian_;
614 static ETL_CONSTANT
size_t Size =
sizeof(T);
619 unaligned_type_ext(
pointer storage_)
620 : private_unaligned_type::unaligned_type_storage_ext<Size>(storage_)
627 unaligned_type_ext(T value,
pointer storage_)
628 : private_unaligned_type::unaligned_type_storage_ext<Size>(storage_)
630 unaligned_copy::copy_value_to_store(value, this->storage);
636 template <
int Endian_Other>
637 unaligned_type_ext(
const unaligned_type_ext<T, Endian_Other>& other,
pointer storage_)
638 : private_unaligned_type::unaligned_type_storage_ext<Size>(storage_)
640 unaligned_copy::copy_store_to_store(other.data(), Endian_Other, this->storage);
647 unaligned_type_ext(unaligned_type_ext<T, Endian>&& other)
648 : private_unaligned_type::unaligned_type_storage_ext<Size>(other.storage)
650 other.storage = ETL_NULLPTR;
656 template <
int Endian_Other>
657 unaligned_type_ext(unaligned_type_ext<T, Endian_Other>&& other)
658 : private_unaligned_type::unaligned_type_storage_ext<Size>(other.storage)
661 if (
Endian != Endian_Other)
663 etl::reverse(this->
begin(), this->
end());
666 other.storage = ETL_NULLPTR;
673 unaligned_type_ext& operator =(T value)
675 unaligned_copy::copy_value_to_store(value, this->storage);
683 unaligned_type_ext& operator =(
const unaligned_type_ext<T, Endian>& other)
685 unaligned_copy::copy_store_to_store(other.data(),
Endian, this->storage);
693 template <
int Endian_Other>
694 unaligned_type_ext& operator =(
const unaligned_type_ext<T, Endian_Other>& other)
696 unaligned_copy::copy_store_to_store(other.data(), Endian_Other, this->storage);
705 unaligned_type_ext& operator =(unaligned_type_ext<T, Endian>&& other)
707 this->storage = other.storage;
708 other.storage = ETL_NULLPTR;
716 template <
int Endian_Other>
717 unaligned_type_ext& operator =(unaligned_type_ext<T, Endian_Other>&& other)
719 this->storage = other.storage;
722 if (
Endian != Endian_Other)
724 etl::reverse(this->
begin(), this->
end());
727 other.storage = ETL_NULLPTR;
740 unaligned_copy::copy_store_to_value(this->storage, value);
752 unaligned_copy::copy_store_to_value(this->storage, value);
760 void set_storage(
pointer storage_)
762 this->storage = storage_;
767 unaligned_type_ext() ETL_DELETE;
771 template <
typename T,
int Endian_>
772 ETL_CONSTANT
int unaligned_type_ext<T, Endian_>::Endian;
774 template <
typename T,
int Endian_>
775 ETL_CONSTANT
size_t unaligned_type_ext<T, Endian_>::Size;
777#if ETL_HAS_CONSTEXPR_ENDIANNESS
779 typedef unaligned_type<char, etl::endianness::value()> host_char_t;
780 typedef unaligned_type<
signed char, etl::endianness::value()> host_schar_t;
781 typedef unaligned_type<
unsigned char, etl::endianness::value()> host_uchar_t;
782 typedef unaligned_type<short, etl::endianness::value()> host_short_t;
783 typedef unaligned_type<
unsigned short, etl::endianness::value()> host_ushort_t;
784 typedef unaligned_type<int, etl::endianness::value()> host_int_t;
785 typedef unaligned_type<
unsigned int, etl::endianness::value()> host_uint_t;
786 typedef unaligned_type<long, etl::endianness::value()> host_long_t;
787 typedef unaligned_type<
unsigned long, etl::endianness::value()> host_ulong_t;
788 typedef unaligned_type<
long long, etl::endianness::value()> host_long_long_t;
789 typedef unaligned_type<
unsigned long long, etl::endianness::value()> host_ulong_long_t;
790#if ETL_USING_8BIT_TYPES
791 typedef unaligned_type<int8_t, etl::endianness::value()> host_int8_t;
792 typedef unaligned_type<uint8_t, etl::endianness::value()> host_uint8_t;
794 typedef unaligned_type<int16_t, etl::endianness::value()> host_int16_t;
795 typedef unaligned_type<uint16_t, etl::endianness::value()> host_uint16_t;
796 typedef unaligned_type<int32_t, etl::endianness::value()> host_int32_t;
797 typedef unaligned_type<uint32_t, etl::endianness::value()> host_uint32_t;
798#if ETL_USING_64BIT_TYPES
799 typedef unaligned_type<int64_t, etl::endianness::value()> host_int64_t;
800 typedef unaligned_type<uint64_t, etl::endianness::value()> host_uint64_t;
802 typedef unaligned_type<float, etl::endianness::value()> host_float_t;
803 typedef unaligned_type<double, etl::endianness::value()> host_double_t;
804 typedef unaligned_type<
long double, etl::endianness::value()> host_long_double_t;
808 typedef unaligned_type<char, etl::endian::little> le_char_t;
809 typedef unaligned_type<signed char, etl::endian::little> le_schar_t;
810 typedef unaligned_type<unsigned char, etl::endian::little> le_uchar_t;
811 typedef unaligned_type<short, etl::endian::little> le_short_t;
812 typedef unaligned_type<unsigned short, etl::endian::little> le_ushort_t;
813 typedef unaligned_type<int, etl::endian::little> le_int_t;
814 typedef unaligned_type<unsigned int, etl::endian::little> le_uint_t;
815 typedef unaligned_type<long, etl::endian::little> le_long_t;
816 typedef unaligned_type<unsigned long, etl::endian::little> le_ulong_t;
817 typedef unaligned_type<long long, etl::endian::little> le_long_long_t;
818 typedef unaligned_type<unsigned long long, etl::endian::little> le_ulong_long_t;
819#if ETL_USING_8BIT_TYPES
820 typedef unaligned_type<int8_t, etl::endian::little> le_int8_t;
821 typedef unaligned_type<uint8_t, etl::endian::little> le_uint8_t;
823 typedef unaligned_type<int16_t, etl::endian::little> le_int16_t;
824 typedef unaligned_type<uint16_t, etl::endian::little> le_uint16_t;
825 typedef unaligned_type<int32_t, etl::endian::little> le_int32_t;
826 typedef unaligned_type<uint32_t, etl::endian::little> le_uint32_t;
827#if ETL_USING_64BIT_TYPES
828 typedef unaligned_type<int64_t, etl::endian::little> le_int64_t;
829 typedef unaligned_type<uint64_t, etl::endian::little> le_uint64_t;
831 typedef unaligned_type<float, etl::endian::little> le_float_t;
832 typedef unaligned_type<double, etl::endian::little> le_double_t;
833 typedef unaligned_type<long double, etl::endian::little> le_long_double_t;
836 typedef unaligned_type<char, etl::endian::big> be_char_t;
837 typedef unaligned_type<signed char, etl::endian::big> be_schar_t;
838 typedef unaligned_type<unsigned char, etl::endian::big> be_uchar_t;
839 typedef unaligned_type<short, etl::endian::big> be_short_t;
840 typedef unaligned_type<unsigned short, etl::endian::big> be_ushort_t;
841 typedef unaligned_type<int, etl::endian::big> be_int_t;
842 typedef unaligned_type<unsigned int, etl::endian::big> be_uint_t;
843 typedef unaligned_type<long, etl::endian::big> be_long_t;
844 typedef unaligned_type<unsigned long, etl::endian::big> be_ulong_t;
845 typedef unaligned_type<long long, etl::endian::big> be_long_long_t;
846 typedef unaligned_type<unsigned long long, etl::endian::big> be_ulong_long_t;
847#if ETL_USING_8BIT_TYPES
848 typedef unaligned_type<int8_t, etl::endian::big> be_int8_t;
849 typedef unaligned_type<uint8_t, etl::endian::big> be_uint8_t;
851 typedef unaligned_type<int16_t, etl::endian::big> be_int16_t;
852 typedef unaligned_type<uint16_t, etl::endian::big> be_uint16_t;
853 typedef unaligned_type<int32_t, etl::endian::big> be_int32_t;
854 typedef unaligned_type<uint32_t, etl::endian::big> be_uint32_t;
855#if ETL_USING_64BIT_TYPES
856 typedef unaligned_type<int64_t, etl::endian::big> be_int64_t;
857 typedef unaligned_type<uint64_t, etl::endian::big> be_uint64_t;
859 typedef unaligned_type<float, etl::endian::big> be_float_t;
860 typedef unaligned_type<double, etl::endian::big> be_double_t;
861 typedef unaligned_type<long double, etl::endian::big> be_long_double_t;
864 typedef be_char_t net_char_t;
865 typedef be_schar_t net_schar_t;
866 typedef be_uchar_t net_uchar_t;
867 typedef be_short_t net_short_t;
868 typedef be_ushort_t net_ushort_t;
869 typedef be_int_t net_int_t;
870 typedef be_uint_t net_uint_t;
871 typedef be_long_t net_long_t;
872 typedef be_ulong_t net_ulong_t;
873 typedef be_long_long_t net_long_long_t;
874 typedef be_ulong_long_t net_ulong_long_t;
875#if ETL_USING_8BIT_TYPES
876 typedef be_int8_t net_int8_t;
877 typedef be_uint8_t net_uint8_t;
879 typedef be_int16_t net_int16_t;
880 typedef be_uint16_t net_uint16_t;
881 typedef be_int32_t net_int32_t;
882 typedef be_uint32_t net_uint32_t;
883#if ETL_USING_64BIT_TYPES
884 typedef be_int64_t net_int64_t;
885 typedef be_uint64_t net_uint64_t;
887 typedef be_float_t net_float_t;
888 typedef be_double_t net_double_t;
889 typedef be_long_double_t net_long_double_t;
892 template <
typename T,
int Endian>
893 using unaligned_type_t =
typename etl::unaligned_type<T, Endian>::type;
897 template <
typename T,
int Endian>
898 constexpr size_t unaligned_type_v = etl::unaligned_type<T, Endian>::Size;
901#if ETL_HAS_CONSTEXPR_ENDIANNESS
903 typedef unaligned_type_ext<char, etl::endianness::value()> host_char_ext_t;
904 typedef unaligned_type_ext<
signed char, etl::endianness::value()> host_schar_ext_t;
905 typedef unaligned_type_ext<
unsigned char, etl::endianness::value()> host_uchar_ext_t;
906 typedef unaligned_type_ext<short, etl::endianness::value()> host_short_ext_t;
907 typedef unaligned_type_ext<
unsigned short, etl::endianness::value()> host_ushort_ext_t;
908 typedef unaligned_type_ext<int, etl::endianness::value()> host_int_ext_t;
909 typedef unaligned_type_ext<
unsigned int, etl::endianness::value()> host_uint_ext_t;
910 typedef unaligned_type_ext<long, etl::endianness::value()> host_long_ext_t;
911 typedef unaligned_type_ext<
unsigned long, etl::endianness::value()> host_ulong_ext_t;
912 typedef unaligned_type_ext<
long long, etl::endianness::value()> host_long_long_ext_t;
913 typedef unaligned_type_ext<
unsigned long long, etl::endianness::value()> host_ulong_long_ext_t;
914#if ETL_USING_8BIT_TYPES
915 typedef unaligned_type_ext<int8_t, etl::endianness::value()> host_int8_ext_t;
916 typedef unaligned_type_ext<uint8_t, etl::endianness::value()> host_uint8_ext_t;
918 typedef unaligned_type_ext<int16_t, etl::endianness::value()> host_int16_ext_t;
919 typedef unaligned_type_ext<uint16_t, etl::endianness::value()> host_uint16_ext_t;
920 typedef unaligned_type_ext<int32_t, etl::endianness::value()> host_int32_ext_t;
921 typedef unaligned_type_ext<uint32_t, etl::endianness::value()> host_uint32_ext_t;
922#if ETL_USING_64BIT_TYPES
923 typedef unaligned_type_ext<int64_t, etl::endianness::value()> host_int64_ext_t;
924 typedef unaligned_type_ext<uint64_t, etl::endianness::value()> host_uint64_ext_t;
926 typedef unaligned_type_ext<float, etl::endianness::value()> host_float_ext_t;
927 typedef unaligned_type_ext<double, etl::endianness::value()> host_double_ext_t;
928 typedef unaligned_type_ext<
long double, etl::endianness::value()> host_long_double_ext_t;
932 typedef unaligned_type_ext<char, etl::endian::little> le_char_ext_t;
933 typedef unaligned_type_ext<signed char, etl::endian::little> le_schar_ext_t;
934 typedef unaligned_type_ext<unsigned char, etl::endian::little> le_uchar_ext_t;
935 typedef unaligned_type_ext<short, etl::endian::little> le_short_ext_t;
936 typedef unaligned_type_ext<unsigned short, etl::endian::little> le_ushort_ext_t;
937 typedef unaligned_type_ext<int, etl::endian::little> le_int_ext_t;
938 typedef unaligned_type_ext<unsigned int, etl::endian::little> le_uint_ext_t;
939 typedef unaligned_type_ext<long, etl::endian::little> le_long_ext_t;
940 typedef unaligned_type_ext<unsigned long, etl::endian::little> le_ulong_ext_t;
941 typedef unaligned_type_ext<long long, etl::endian::little> le_long_long_ext_t;
942 typedef unaligned_type_ext<unsigned long long, etl::endian::little> le_ulong_long_ext_t;
943 #if ETL_USING_8BIT_TYPES
944 typedef unaligned_type_ext<int8_t, etl::endian::little> le_int8_ext_t;
945 typedef unaligned_type_ext<uint8_t, etl::endian::little> le_uint8_ext_t;
947 typedef unaligned_type_ext<int16_t, etl::endian::little> le_int16_ext_t;
948 typedef unaligned_type_ext<uint16_t, etl::endian::little> le_uint16_ext_t;
949 typedef unaligned_type_ext<int32_t, etl::endian::little> le_int32_ext_t;
950 typedef unaligned_type_ext<uint32_t, etl::endian::little> le_uint32_ext_t;
951 #if ETL_USING_64BIT_TYPES
952 typedef unaligned_type_ext<int64_t, etl::endian::little> le_int64_ext_t;
953 typedef unaligned_type_ext<uint64_t, etl::endian::little> le_uint64_ext_t;
955 typedef unaligned_type_ext<float, etl::endian::little> le_float_ext_t;
956 typedef unaligned_type_ext<double, etl::endian::little> le_double_ext_t;
957 typedef unaligned_type_ext<long double, etl::endian::little> le_long_double_ext_t;
960 typedef unaligned_type_ext<char, etl::endian::big> be_char_ext_t;
961 typedef unaligned_type_ext<signed char, etl::endian::big> be_schar_ext_t;
962 typedef unaligned_type_ext<unsigned char, etl::endian::big> be_uchar_ext_t;
963 typedef unaligned_type_ext<short, etl::endian::big> be_short_ext_t;
964 typedef unaligned_type_ext<unsigned short, etl::endian::big> be_ushort_ext_t;
965 typedef unaligned_type_ext<int, etl::endian::big> be_int_ext_t;
966 typedef unaligned_type_ext<unsigned int, etl::endian::big> be_uint_ext_t;
967 typedef unaligned_type_ext<long, etl::endian::big> be_long_ext_t;
968 typedef unaligned_type_ext<unsigned long, etl::endian::big> be_ulong_ext_t;
969 typedef unaligned_type_ext<long long, etl::endian::big> be_long_long_ext_t;
970 typedef unaligned_type_ext<unsigned long long, etl::endian::big> be_ulong_long_ext_t;
971 #if ETL_USING_8BIT_TYPES
972 typedef unaligned_type_ext<int8_t, etl::endian::big> be_int8_ext_t;
973 typedef unaligned_type_ext<uint8_t, etl::endian::big> be_uint8_ext_t;
975 typedef unaligned_type_ext<int16_t, etl::endian::big> be_int16_ext_t;
976 typedef unaligned_type_ext<uint16_t, etl::endian::big> be_uint16_ext_t;
977 typedef unaligned_type_ext<int32_t, etl::endian::big> be_int32_ext_t;
978 typedef unaligned_type_ext<uint32_t, etl::endian::big> be_uint32_ext_t;
979 #if ETL_USING_64BIT_TYPES
980 typedef unaligned_type_ext<int64_t, etl::endian::big> be_int64_ext_t;
981 typedef unaligned_type_ext<uint64_t, etl::endian::big> be_uint64_ext_t;
983 typedef unaligned_type_ext<float, etl::endian::big> be_float_ext_t;
984 typedef unaligned_type_ext<double, etl::endian::big> be_double_ext_t;
985 typedef unaligned_type_ext<long double, etl::endian::big> be_long_double_ext_t;
988 typedef be_char_ext_t net_char_ext_t;
989 typedef be_schar_ext_t net_schar_ext_t;
990 typedef be_uchar_ext_t net_uchar_ext_t;
991 typedef be_short_ext_t net_short_ext_t;
992 typedef be_ushort_ext_t net_ushort_ext_t;
993 typedef be_int_ext_t net_int_ext_t;
994 typedef be_uint_ext_t net_uint_ext_t;
995 typedef be_long_ext_t net_long_ext_t;
996 typedef be_ulong_ext_t net_ulong_ext_t;
997 typedef be_long_long_ext_t net_long_long_ext_t;
998 typedef be_ulong_long_ext_t net_ulong_long_ext_t;
999#if ETL_USING_8BIT_TYPES
1000 typedef be_int8_ext_t net_int8_ext_t;
1001 typedef be_uint8_ext_t net_uint8_ext_t;
1003 typedef be_int16_ext_t net_int16_ext_t;
1004 typedef be_uint16_ext_t net_uint16_ext_t;
1005 typedef be_int32_ext_t net_int32_ext_t;
1006 typedef be_uint32_ext_t net_uint32_ext_t;
1007#if ETL_USING_64BIT_TYPES
1008 typedef be_int64_ext_t net_int64_ext_t;
1009 typedef be_uint64_ext_t net_uint64_ext_t;
1011 typedef be_float_ext_t net_float_ext_t;
1012 typedef be_double_ext_t net_double_ext_t;
1013 typedef be_long_double_ext_t net_long_double_ext_t;
1016 template <
typename T,
int Endian>
1017 using unaligned_type_ext_t =
typename etl::unaligned_type_ext<T, Endian>::type;
1021 template <
typename T,
int Endian>
1022 constexpr size_t unaligned_type_ext_t_v = etl::unaligned_type_ext<T, Endian>::Size;
Unaligned copy.
Definition unaligned_type.h:327
Definition iterator.h:228
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:740
#define ETL_ASSERT(b, e)
Definition error_handler.h:356
ETL_CONSTEXPR exception(string_type reason_, string_type, numeric_type line_)
Constructor.
Definition exception.h:69
Definition exception.h:47
is_floating_point
Definition type_traits_generator.h:1094
bitset_ext
Definition absolute.h:39
ETL_CONSTEXPR TContainer::reverse_iterator rend(TContainer &container)
Definition iterator.h:1114
ETL_CONSTEXPR TContainer::const_reverse_iterator crbegin(const TContainer &container)
Definition iterator.h:1104
ETL_CONSTEXPR TContainer::reverse_iterator rbegin(TContainer &container)
Definition iterator.h:1084
ETL_CONSTEXPR TContainer::const_iterator cbegin(const TContainer &container)
Definition iterator.h:982
ETL_CONSTEXPR TContainer::size_type size(const TContainer &container)
Definition iterator.h:1187
ETL_CONSTEXPR TContainer::iterator begin(TContainer &container)
Definition iterator.h:962
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:451
ETL_CONSTEXPR TContainer::const_reverse_iterator crend(const TContainer &container)
Definition iterator.h:1134
ETL_CONSTEXPR TContainer::const_iterator cend(const TContainer &container)
Definition iterator.h:1012
ETL_CONSTEXPR TContainer::iterator end(TContainer &container)
Definition iterator.h:992
iterator
Definition iterator.h:399
ETL_PACKED_CLASS(unaligned_type_common)
Definition unaligned_type.h:88