Embedded Template Library 1.0
Loading...
Searching...
No Matches
unaligned_type.h
Go to the documentation of this file.
1
2
3/******************************************************************************
4The MIT License(MIT)
5
6Embedded Template Library.
7https://github.com/ETLCPP/etl
8https://www.etlcpp.com
9
10Copyright(c) 2022 John Wellbelove
11
12Permission is hereby granted, free of charge, to any person obtaining a copy
13of this software and associated documentation files(the "Software"), to deal
14in the Software without restriction, including without limitation the rights
15to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
16copies of the Software, and to permit persons to whom the Software is
17furnished to do so, subject to the following conditions :
18
19The above copyright notice and this permission notice shall be included in all
20copies or substantial portions of the Software.
21
22THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
25AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28SOFTWARE.
29******************************************************************************/
30
31#ifndef ETL_UNALIGNED_TYPE_INCLUDED
32#define ETL_UNALIGNED_TYPE_INCLUDED
33
37
38#include "platform.h"
39#include "type_traits.h"
40#include "endianness.h"
41#include "iterator.h"
42#include "algorithm.h"
43#include "bit.h"
44
45#include <string.h>
46
47namespace etl
48{
49 namespace private_unaligned_type
50 {
51 //*************************************************************************
54 //*************************************************************************
55 template <size_t Size_>
57 {
58 public:
59
60 static ETL_CONSTANT size_t Size = Size_;
61
62 typedef unsigned char storage_type;
63 typedef storage_type* pointer;
64 typedef const storage_type* const_pointer;
65 typedef storage_type* iterator;
66 typedef const storage_type* const_iterator;
69
70 //*************************************************************************
72 //*************************************************************************
73 ETL_CONSTEXPR unaligned_type_common()
74 : storage()
75 {
76 }
77
78 //*************************************************************************
80 //*************************************************************************
81 ETL_CONSTEXPR size_t size() const
82 {
83 return Size;
84 }
85
86 //*************************************************************************
88 //*************************************************************************
90 {
91 return storage;
92 }
93
94 //*************************************************************************
96 //*************************************************************************
97 ETL_CONSTEXPR const_pointer data() const
98 {
99 return storage;
100 }
101
102 //*************************************************************************
104 //*************************************************************************
106 {
107 return iterator(storage);
108 }
109
110 //*************************************************************************
112 //*************************************************************************
113 ETL_CONSTEXPR const_iterator begin() const
114 {
115 return const_iterator(storage);
116 }
117
118 //*************************************************************************
120 //*************************************************************************
121 ETL_CONSTEXPR const_iterator cbegin() const
122 {
123 return const_iterator(storage);
124 }
125
126 //*************************************************************************
128 //*************************************************************************
130 {
131 return reverse_iterator(storage + Size);
132 }
133
134 //*************************************************************************
136 //*************************************************************************
137 ETL_CONSTEXPR14 const_reverse_iterator rbegin() const
138 {
139 return const_reverse_iterator(storage + Size);
140 }
141
142 //*************************************************************************
144 //*************************************************************************
145 ETL_CONSTEXPR14 const_reverse_iterator crbegin() const
146 {
147 return const_reverse_iterator(storage + Size);
148 }
149
150 //*************************************************************************
152 //*************************************************************************
154 {
155 return iterator(storage + Size);
156 }
157
158 //*************************************************************************
160 //*************************************************************************
161 ETL_CONSTEXPR const_iterator end() const
162 {
163 return const_iterator(storage + Size);
164 }
165
166 //*************************************************************************
168 //*************************************************************************
169 ETL_CONSTEXPR const_iterator cend() const
170 {
171 return const_iterator(storage + Size);
172 }
173
174 //*************************************************************************
176 //*************************************************************************
178 {
179 return reverse_iterator(storage);
180 }
181
182 //*************************************************************************
184 //*************************************************************************
185 ETL_CONSTEXPR14 const_reverse_iterator rend() const
186 {
187 return const_reverse_iterator(storage);
188 }
189
190 //*************************************************************************
192 //*************************************************************************
193 ETL_CONSTEXPR14 const_reverse_iterator crend() const
194 {
195 return const_reverse_iterator(storage);
196 }
197
198 //*************************************************************************
200 //*************************************************************************
202 {
203 return storage[i];
204 }
205
206 //*************************************************************************
208 //*************************************************************************
209 ETL_CONSTEXPR const storage_type& operator[](int i) const
210 {
211 return storage[i];
212 }
213
214 protected:
215
216 unsigned char storage[Size];
217 };
218
219 template <size_t Size_>
220 ETL_CONSTANT size_t unaligned_type_common<Size_>::Size;
221 }
222
223 //*************************************************************************
228 //*************************************************************************
229 template <typename T, int Endian_>
231 {
232 public:
233
234 ETL_STATIC_ASSERT(etl::is_integral<T>::value || etl::is_floating_point<T>::value, "Unaligned type must be integral or floating point");
235
236 typedef T value_type;
237
238 typedef typename private_unaligned_type::unaligned_type_common<sizeof(T)>::storage_type storage_type;
239 typedef typename private_unaligned_type::unaligned_type_common<sizeof(T)>::pointer pointer;
240 typedef typename private_unaligned_type::unaligned_type_common<sizeof(T)>::const_pointer const_pointer;
241 typedef typename private_unaligned_type::unaligned_type_common<sizeof(T)>::iterator iterator;
242 typedef typename private_unaligned_type::unaligned_type_common<sizeof(T)>::const_iterator const_iterator;
243 typedef typename private_unaligned_type::unaligned_type_common<sizeof(T)>::reverse_iterator reverse_iterator;
244 typedef typename private_unaligned_type::unaligned_type_common<sizeof(T)>::const_reverse_iterator const_reverse_iterator;
245
246 static ETL_CONSTANT int Endian = Endian_;
247 static ETL_CONSTANT size_t Size = private_unaligned_type::unaligned_type_common<sizeof(T)>::Size;
248
249 //*************************************************************************
251 //*************************************************************************
252 ETL_CONSTEXPR unaligned_type()
253 {
254 }
255
256 //*************************************************************************
258 //*************************************************************************
259 ETL_CONSTEXPR14 unaligned_type(T value)
260 {
261 unaligned_copy<T>::copy(value, this->storage);
262 }
263
264 //*************************************************************************
266 //*************************************************************************
267 template <int Endian_Other>
269 {
271 }
272
273 //*************************************************************************
275 //*************************************************************************
277 {
278 unaligned_copy<T>::copy(value, this->storage);
279
280 return *this;
281 }
282
283 //*************************************************************************
285 //*************************************************************************
286 template <int Endian_Other>
288 {
290
291 return *this;
292 }
293
294 //*************************************************************************
296 //*************************************************************************
297 ETL_CONSTEXPR14 operator T() const
298 {
299 T value = T();
300
301 unaligned_copy<T>::copy(this->storage, value);
302
303 return value;
304 }
305
306 //*************************************************************************
308 //*************************************************************************
309 ETL_CONSTEXPR14 T value() const
310 {
311 T value = T();
312
313 unaligned_copy<T>::copy(this->storage, value);
314
315 return value;
316 }
317
318 //*************************************************************************
320 //*************************************************************************
321 template <typename U, size_t Size = sizeof(U), typename Enable = void>
323
324 //*******************************************
327 //*******************************************
328 template <typename U>
330 {
331 //*******************************
332 static ETL_CONSTEXPR14 void copy(T value, pointer store)
333 {
334 store[0] = static_cast<storage_type>(value);
335 }
336
337 //*******************************
338 static ETL_CONSTEXPR14 void copy(const_pointer store, T& value)
339 {
340 value = static_cast<T>(store[0]);
341 }
342
343 //*******************************
344 static ETL_CONSTEXPR14 void copy(const_pointer src, int /*endian_src*/, unsigned char* dst)
345 {
346 dst[0] = src[0];
347 }
348 };
349
350 //*******************************************
353 //*******************************************
354 template <typename U>
355 struct unaligned_copy<U, 2U, typename etl::enable_if<etl::is_integral<U>::value>::type>
356 {
357 //*******************************
358 static ETL_CONSTEXPR14 void copy(T value, unsigned char* store)
359 {
360 if (Endian == etl::endianness::value())
361 {
362 store[0] = static_cast<storage_type>(value);
363 store[1] = static_cast<storage_type>(value >> (1U * CHAR_BIT));
364 }
365 else
366 {
367 store[1] = static_cast<storage_type>(value);
368 store[0] = static_cast<storage_type>(value >> (1U * CHAR_BIT));
369 }
370 }
371
372 //*******************************
373 static ETL_CONSTEXPR14 void copy(const_pointer store, T& value)
374 {
375 if (Endian == etl::endianness::value())
376 {
377 value = static_cast<T>(static_cast<unsigned char>(store[0]));
378 value |= static_cast<T>(static_cast<unsigned char>(store[1])) << (1U * CHAR_BIT);
379 }
380 else
381 {
382 value = static_cast<T>(static_cast<unsigned char>(store[1]));
383 value |= static_cast<T>(static_cast<unsigned char>(store[0])) << (1U * CHAR_BIT);
384 }
385 }
386
387 //*******************************
388 static ETL_CONSTEXPR14 void copy(const_pointer src, int endian_src, unsigned char* dst)
389 {
390 if (Endian == endian_src)
391 {
392 dst[0] = src[0];
393 dst[1] = src[1];
394 }
395 else
396 {
397 dst[0] = src[1];
398 dst[1] = src[0];
399 }
400 }
401 };
402
403 //*******************************************
407 //*******************************************
408 template <typename U>
409 struct unaligned_copy<U, 4U, typename etl::enable_if<etl::is_integral<U>::value>::type>
410 {
411 static ETL_CONSTEXPR14 void copy(T value, unsigned char* store)
412 {
413 if (Endian == etl::endianness::value())
414 {
415 store[0] = static_cast<storage_type>(value);
416 store[1] = static_cast<storage_type>(value >> (1U * CHAR_BIT));
417 store[2] = static_cast<storage_type>(value >> (2U * CHAR_BIT));
418 store[3] = static_cast<storage_type>(value >> (3U * CHAR_BIT));
419 }
420 else
421 {
422 store[3] = static_cast<storage_type>(value);
423 store[2] = static_cast<storage_type>(value >> (1U * CHAR_BIT));
424 store[1] = static_cast<storage_type>(value >> (2U * CHAR_BIT));
425 store[0] = static_cast<storage_type>(value >> (3U * CHAR_BIT));
426 }
427 }
428
429 //*******************************
430 static ETL_CONSTEXPR14 void copy(const_pointer store, T& value)
431 {
432 if (Endian == etl::endianness::value())
433 {
434 value = static_cast<T>(static_cast<unsigned char>(store[0]));
435 value |= static_cast<T>(static_cast<unsigned char>(store[1])) << (1U * CHAR_BIT);
436 value |= static_cast<T>(static_cast<unsigned char>(store[2])) << (2U * CHAR_BIT);
437 value |= static_cast<T>(static_cast<unsigned char>(store[3])) << (3U * CHAR_BIT);
438 }
439 else
440 {
441 value = static_cast<T>(static_cast<unsigned char>(store[3]));
442 value |= static_cast<T>(static_cast<unsigned char>(store[2])) << (1U * CHAR_BIT);
443 value |= static_cast<T>(static_cast<unsigned char>(store[1])) << (2U * CHAR_BIT);
444 value |= static_cast<T>(static_cast<unsigned char>(store[0])) << (3U * CHAR_BIT);
445 }
446 }
447
448 //*******************************
449 static ETL_CONSTEXPR14 void copy(const_pointer src, int endian_src, unsigned char* dst)
450 {
451 if (Endian == endian_src)
452 {
453 dst[0] = src[0];
454 dst[1] = src[1];
455 dst[2] = src[2];
456 dst[3] = src[3];
457 }
458 else
459 {
460 dst[0] = src[3];
461 dst[1] = src[2];
462 dst[2] = src[1];
463 dst[3] = src[0];
464 }
465 }
466 };
467
468 //*******************************************
472 //*******************************************
473 template <typename U>
474 struct unaligned_copy<U, 4U, typename etl::enable_if<etl::is_floating_point<U>::value>::type>
475 {
476 static void copy(T value, unsigned char* store)
477 {
478 memcpy(store, &value, 4U);
479
480 if (Endian != etl::endianness::value())
481 {
482 etl::reverse(store, store + 4U);
483 }
484 }
485
486 //*******************************
487 static void copy(const_pointer store, T& value)
488 {
489 unsigned char temp[4U];
490 memcpy(temp, store, 4U);
491
492 if (Endian != etl::endianness::value())
493 {
494 etl::reverse(temp, temp + 4U);
495 }
496
497 memcpy(&value, temp, 4U);
498 }
499
500 //*******************************
501 static ETL_CONSTEXPR14 void copy(const_pointer src, int endian_src, unsigned char* dst)
502 {
503 memcpy(dst, src, 4U);
504
505 if (Endian != endian_src)
506 {
507 etl::reverse(dst, dst + 4U);
508 }
509 }
510 };
511
512 //*******************************************
516 //*******************************************
517 template <typename U>
518 struct unaligned_copy<U, 8U, typename etl::enable_if<etl::is_integral<U>::value>::type>
519 {
520 static ETL_CONSTEXPR14 void copy(T value, unsigned char* store)
521 {
522 if (Endian == etl::endianness::value())
523 {
524 store[0] = static_cast<storage_type>(value);
525 store[1] = static_cast<storage_type>(value >> (1U * CHAR_BIT));
526 store[2] = static_cast<storage_type>(value >> (2U * CHAR_BIT));
527 store[3] = static_cast<storage_type>(value >> (3U * CHAR_BIT));
528 store[4] = static_cast<storage_type>(value >> (4U * CHAR_BIT));
529 store[5] = static_cast<storage_type>(value >> (5U * CHAR_BIT));
530 store[6] = static_cast<storage_type>(value >> (6U * CHAR_BIT));
531 store[7] = static_cast<storage_type>(value >> (7U * CHAR_BIT));
532 }
533 else
534 {
535 store[7] = static_cast<storage_type>(value);
536 store[6] = static_cast<storage_type>(value >> (1U * CHAR_BIT));
537 store[5] = static_cast<storage_type>(value >> (2U * CHAR_BIT));
538 store[4] = static_cast<storage_type>(value >> (3U * CHAR_BIT));
539 store[3] = static_cast<storage_type>(value >> (4U * CHAR_BIT));
540 store[2] = static_cast<storage_type>(value >> (5U * CHAR_BIT));
541 store[1] = static_cast<storage_type>(value >> (6U * CHAR_BIT));
542 store[0] = static_cast<storage_type>(value >> (7U * CHAR_BIT));
543 }
544 }
545
546 //*******************************
547 static ETL_CONSTEXPR14 void copy(const_pointer store, T& value)
548 {
549 if (Endian == etl::endianness::value())
550 {
551 value = static_cast<T>(static_cast<unsigned char>(store[0]));
552 value |= static_cast<T>(static_cast<unsigned char>(store[1])) << (1U * CHAR_BIT);
553 value |= static_cast<T>(static_cast<unsigned char>(store[2])) << (2U * CHAR_BIT);
554 value |= static_cast<T>(static_cast<unsigned char>(store[3])) << (3U * CHAR_BIT);
555 value |= static_cast<T>(static_cast<unsigned char>(store[4])) << (4U * CHAR_BIT);
556 value |= static_cast<T>(static_cast<unsigned char>(store[5])) << (5U * CHAR_BIT);
557 value |= static_cast<T>(static_cast<unsigned char>(store[6])) << (6U * CHAR_BIT);
558 value |= static_cast<T>(static_cast<unsigned char>(store[7])) << (7U * CHAR_BIT);
559 }
560 else
561 {
562 value = static_cast<T>(static_cast<unsigned char>(store[7]));
563 value |= static_cast<T>(static_cast<unsigned char>(store[6])) << (1U * CHAR_BIT);
564 value |= static_cast<T>(static_cast<unsigned char>(store[5])) << (2U * CHAR_BIT);
565 value |= static_cast<T>(static_cast<unsigned char>(store[4])) << (3U * CHAR_BIT);
566 value |= static_cast<T>(static_cast<unsigned char>(store[3])) << (4U * CHAR_BIT);
567 value |= static_cast<T>(static_cast<unsigned char>(store[2])) << (5U * CHAR_BIT);
568 value |= static_cast<T>(static_cast<unsigned char>(store[1])) << (6U * CHAR_BIT);
569 value |= static_cast<T>(static_cast<unsigned char>(store[0])) << (7U * CHAR_BIT);
570 }
571 }
572
573 //*******************************
574 static ETL_CONSTEXPR14 void copy(const_pointer src, int endian_src, unsigned char* dst)
575 {
576 if (Endian == endian_src)
577 {
578 dst[0] = src[0];
579 dst[1] = src[1];
580 dst[2] = src[2];
581 dst[3] = src[3];
582 dst[4] = src[4];
583 dst[5] = src[5];
584 dst[6] = src[6];
585 dst[7] = src[7];
586 }
587 else
588 {
589 dst[0] = src[7];
590 dst[1] = src[6];
591 dst[2] = src[5];
592 dst[3] = src[4];
593 dst[4] = src[3];
594 dst[5] = src[2];
595 dst[6] = src[1];
596 dst[7] = src[0];
597 }
598 }
599 };
600
601 //*******************************************
605 //*******************************************
606 template <typename U>
607 struct unaligned_copy<U, 8U, typename etl::enable_if<etl::is_floating_point<U>::value>::type>
608 {
609 static void copy(T value, unsigned char* store)
610 {
611 memcpy(store, &value, 8U);
612
613 if (Endian != etl::endianness::value())
614 {
615 etl::reverse(store, store + 8U);
616 }
617 }
618
619 //*******************************
620 static void copy(const_pointer store, T& value)
621 {
622 unsigned char temp[8U];
623 memcpy(temp, store, 8U);
624
625 if (Endian != etl::endianness::value())
626 {
627 etl::reverse(temp, temp + 8U);
628 }
629
630 memcpy(&value, temp, 8U);
631 }
632
633 //*******************************
634 static ETL_CONSTEXPR14 void copy(const_pointer src, int endian_src, unsigned char* dst)
635 {
636 memcpy(dst, src, 8U);
637
638 if (Endian != endian_src)
639 {
640 etl::reverse(dst, dst + 8U);
641 }
642 }
643 };
644
645 //*******************************************
649 //*******************************************
650 template <typename U>
651 struct unaligned_copy<U, 12U, typename etl::enable_if<etl::is_floating_point<U>::value>::type>
652 {
653 static void copy(T value, unsigned char* store)
654 {
655 memcpy(store, &value, 12U);
656
657 if (Endian != etl::endianness::value())
658 {
659 etl::reverse(store, store + 12U);
660 }
661 }
662
663 //*******************************
664 static void copy(const_pointer store, T& value)
665 {
666 unsigned char temp[12U];
667 memcpy(temp, store, 12U);
668
669 if (Endian != etl::endianness::value())
670 {
671 etl::reverse(temp, temp + 12U);
672 }
673
674 memcpy(&value, temp, 12U);
675 }
676
677 //*******************************
678 static ETL_CONSTEXPR14 void copy(const_pointer src, int endian_src, unsigned char* dst)
679 {
680 memcpy(dst, src, 12U);
681
682 if (Endian != endian_src)
683 {
684 etl::reverse(dst, dst + 12U);
685 }
686 }
687 };
688
689 //*******************************************
693 //*******************************************
694 template <typename U>
695 struct unaligned_copy<U, 16U, typename etl::enable_if<etl::is_floating_point<U>::value>::type>
696 {
697 static void copy(T value, unsigned char* store)
698 {
699 memcpy(store, &value, 16U);
700
701 if (Endian != etl::endianness::value())
702 {
703 etl::reverse(store, store + 16U);
704 }
705 }
706
707 //*******************************
708 static void copy(const_pointer store, T& value)
709 {
710 unsigned char temp[16U];
711 memcpy(temp, store, 16U);
712
713 if (Endian != etl::endianness::value())
714 {
715 etl::reverse(temp, temp + 16U);
716 }
717
718 memcpy(&value, temp, 16U);
719 }
720
721 //*******************************
722 static ETL_CONSTEXPR14 void copy(const_pointer src, int endian_src, unsigned char* dst)
723 {
724 memcpy(dst, src, 16U);
725
726 if (Endian != endian_src)
727 {
728 etl::reverse(dst, dst + 16U);
729 }
730 }
731 };
732 };
733
734 template <typename T, int Endian_>
735 ETL_CONSTANT int unaligned_type<T, Endian_>::Endian;
736
737 template <typename T, int Endian_>
738 ETL_CONSTANT size_t unaligned_type<T, Endian_>::Size;
739
740#if ETL_HAS_CONSTEXPR_ENDIANNESS
741 // Host order
742 typedef unaligned_type<char, etl::endianness::value()> host_char_t;
743 typedef unaligned_type<signed char, etl::endianness::value()> host_schar_t;
744 typedef unaligned_type<unsigned char, etl::endianness::value()> host_uchar_t;
745 typedef unaligned_type<short, etl::endianness::value()> host_short_t;
746 typedef unaligned_type<unsigned short, etl::endianness::value()> host_ushort_t;
747 typedef unaligned_type<int, etl::endianness::value()> host_int_t;
748 typedef unaligned_type<unsigned int, etl::endianness::value()> host_uint_t;
749 typedef unaligned_type<long, etl::endianness::value()> host_long_t;
750 typedef unaligned_type<unsigned long, etl::endianness::value()> host_ulong_t;
751 typedef unaligned_type<long long, etl::endianness::value()> host_long_long_t;
752 typedef unaligned_type<unsigned long long, etl::endianness::value()> host_ulong_long_t;
753#if ETL_USING_8BIT_TYPES
754 typedef unaligned_type<int8_t, etl::endianness::value()> host_int8_t;
755 typedef unaligned_type<uint8_t, etl::endianness::value()> host_uint8_t;
756#endif
757 typedef unaligned_type<int16_t, etl::endianness::value()> host_int16_t;
758 typedef unaligned_type<uint16_t, etl::endianness::value()> host_uint16_t;
759 typedef unaligned_type<int32_t, etl::endianness::value()> host_int32_t;
760 typedef unaligned_type<uint32_t, etl::endianness::value()> host_uint32_t;
761#if ETL_USING_64BIT_TYPES
762 typedef unaligned_type<int64_t, etl::endianness::value()> host_int64_t;
763 typedef unaligned_type<uint64_t, etl::endianness::value()> host_uint64_t;
764#endif
765 typedef unaligned_type<float, etl::endianness::value()> host_float_t;
766 typedef unaligned_type<double, etl::endianness::value()> host_double_t;
767 typedef unaligned_type<long double, etl::endianness::value()> host_long_double_t;
768#endif
769
770 // Little Endian
782#if ETL_USING_8BIT_TYPES
785#endif
790#if ETL_USING_64BIT_TYPES
793#endif
797
798 // Big Endian
810#if ETL_USING_8BIT_TYPES
813#endif
818#if ETL_USING_64BIT_TYPES
821#endif
825
826 // Network Order
827 typedef be_char_t net_char_t;
828 typedef be_schar_t net_schar_t;
829 typedef be_uchar_t net_uchar_t;
830 typedef be_short_t net_short_t;
832 typedef be_int_t net_int_t;
833 typedef be_uint_t net_uint_t;
834 typedef be_long_t net_long_t;
835 typedef be_ulong_t net_ulong_t;
838#if ETL_USING_8BIT_TYPES
839 typedef be_int8_t net_int8_t;
840 typedef be_uint8_t net_uint8_t;
841#endif
842 typedef be_int16_t net_int16_t;
844 typedef be_int32_t net_int32_t;
846#if ETL_USING_64BIT_TYPES
847 typedef be_int64_t net_int64_t;
849#endif
850 typedef be_float_t net_float_t;
853
854#if ETL_USING_CPP11
855 template <typename T, int Endian>
857#endif
858
859#if ETL_USING_CPP17
860 template <typename T, int Endian>
862#endif
863}
864
865#endif
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