30#ifndef ETL_BITSET_NEW_INCLUDED
31#define ETL_BITSET_NEW_INCLUDED
33#include "../platform.h"
34#include "../algorithm.h"
35#include "../iterator.h"
36#include "../integral_limits.h"
37#include "../algorithm.h"
38#include "../nullptr.h"
40#include "../exception.h"
41#include "../integral_limits.h"
43#include "../char_traits.h"
44#include "../static_assert.h"
45#include "../error_handler.h"
48#include "../enum_type.h"
49#include "../largest.h"
50#include "../smallest.h"
62#if defined(ETL_COMPILER_KEIL)
63#pragma diag_suppress 1300
68 #define ETL_STRL(x) L##x
69 #define ETL_STRu(x) u##x
70 #define ETL_STRU(x) U##x
101 ETL_ENUM_TYPE(Undefined,
"Undefined")
102 ETL_ENUM_TYPE(Single,
"Single")
103 ETL_ENUM_TYPE(Multi,
"Multi")
164 namespace private_bitset
166 template <
typename TElement>
181 template <
typename TElement>
184 template <
typename TElement>
187 template <
typename TElement>
190 template <
typename TElement>
198 template <
typename TElement,
char Bitset_Layout>
205 template <
typename TElement>
229 *pbuffer = All_Set_Element & top_mask;
256 template <
size_t Position>
277 template <
size_t Position,
bool Value>
300 size_t ) ETL_NOEXCEPT
302 *pbuffer = All_Clear_Element;
326 const char* text) ETL_NOEXCEPT
328 reset_all(pbuffer, 1U);
330 if (text != ETL_NULLPTR)
341 if (text[
i] == ETL_STR(
'1'))
359 const wchar_t* text) ETL_NOEXCEPT
361 reset_all(pbuffer, 1U);
363 if (text != ETL_NULLPTR)
374 if (text[
i] == ETL_STRL(
'1'))
392 const char16_t* text) ETL_NOEXCEPT
394 reset_all(pbuffer, 1U);
396 if (text != ETL_NULLPTR)
407 if (text[
i] == ETL_STRu(
'1'))
425 const char32_t* text) ETL_NOEXCEPT
427 reset_all(pbuffer, 1U);
429 if (text != ETL_NULLPTR)
440 if (text[
i] == ETL_STRU(
'1'))
453 template <
typename T>
457 size_t ) ETL_NOEXCEPT
465 template <
typename T>
484 return static_cast<T>(value);
493 template <
typename T,
size_t Position,
size_t Length>
511 return static_cast<T>(value);
524 return (*pbuffer &
mask) != 0
U;
533 size_t ) ETL_NOEXCEPT
543 bool all(const_pointer pbuffer,
545 element_type top_mask) ETL_NOEXCEPT
547 return (*pbuffer & top_mask) == top_mask;
555 bool all(const_pointer pbuffer,
557 element_type top_mask,
558 element_type mask) ETL_NOEXCEPT
560 return (*pbuffer & top_mask & mask) == mask;
569 size_t ) ETL_NOEXCEPT
571 return *pbuffer == All_Clear_Element;
583 return (*pbuffer &
mask) == All_Clear_Element;
592 size_t ) ETL_NOEXCEPT
594 return *pbuffer != All_Clear_Element;
606 return (*pbuffer &
mask) != All_Clear_Element;
615 size_t ) ETL_NOEXCEPT
617 *pbuffer = ~*pbuffer;
646 template <
typename TString>
651 typename TString::value_type
zero =
typename TString::value_type(
'0'),
652 typename TString::value_type
one =
typename TString::value_type(
'1'))
681 size_t position) ETL_NOEXCEPT
686 size_t bit = position;
691 if ((state && (*pbuffer != All_Clear_Element)) || (!state && (*pbuffer != All_Set_Element)))
697 if (((*pbuffer &
mask) != 0) == state)
720 size_t ) ETL_NOEXCEPT
733 size_t ) ETL_NOEXCEPT
746 size_t ) ETL_NOEXCEPT
759 size_t ) ETL_NOEXCEPT
771 size_t ) ETL_NOEXCEPT
773 *pbuffer = ~*pbuffer;
784 size_t shift) ETL_NOEXCEPT
788 reset_all(pbuffer, 1U);
804 size_t shift) ETL_NOEXCEPT
808 reset_all(pbuffer, 1U);
823 size_t ) ETL_NOEXCEPT
831 template <
typename TElementType>
836 unsigned long long value) ETL_NOEXCEPT
848 size_t ) ETL_NOEXCEPT
860 template <
typename TElement>
882 template <
size_t Position,
size_t Length,
size_t Bits_Per_Element>
895 size_t position) ETL_NOEXCEPT
900 return (pbuffer[index] &
mask) != 0;
909 size_t number_of_elements) ETL_NOEXCEPT
913 while (number_of_elements-- != 0)
926 bool all(const_pointer pbuffer,
927 size_t number_of_elements,
928 element_type top_mask) ETL_NOEXCEPT
931 while (number_of_elements-- != 1U)
933 if (*pbuffer++ != All_Set_Element)
940 if ((*pbuffer & top_mask) != top_mask)
954 size_t number_of_elements) ETL_NOEXCEPT
956 while (number_of_elements-- != 0)
973 size_t number_of_elements) ETL_NOEXCEPT
977 while (number_of_elements-- != 0)
979 if (*pbuffer++ != All_Clear_Element)
995 size_t number_of_elements,
998 while (number_of_elements-- != 1U)
1000 *pbuffer++ = All_Set_Element;
1003 *pbuffer = (All_Set_Element & top_mask);
1013 bool value =
true) ETL_NOEXCEPT
1020 pbuffer[index] |=
bit;
1024 pbuffer[index] &=
~bit;
1031 template <
size_t Position>
1042 pbuffer[index] |=
bit;
1046 pbuffer[index] &=
~bit;
1053 template <
size_t Position,
bool Value>
1063 pbuffer[index] |=
bit;
1067 pbuffer[index] &=
~bit;
1077 size_t number_of_elements,
1079 const char* text) ETL_NOEXCEPT
1081 if (text == ETL_NULLPTR)
1083 etl::fill_n(pbuffer, number_of_elements, All_Clear_Element);
1088 size_t index = etl::min(number_of_elements - 1U, (
string_length / Bits_Per_Element));
1091 while (index != number_of_elements)
1093 pbuffer[index++] = All_Clear_Element;
1101 set_position(pbuffer, --
i, *text++ == ETL_STR(
'1'));
1112 size_t number_of_elements,
1114 const wchar_t* text) ETL_NOEXCEPT
1116 if (text == ETL_NULLPTR)
1118 etl::fill_n(pbuffer, number_of_elements, All_Clear_Element);
1123 size_t index = etl::min(number_of_elements - 1U, (
string_length / Bits_Per_Element));
1126 while (index != number_of_elements)
1128 pbuffer[index++] = All_Clear_Element;
1136 set_position(pbuffer, --
i, *text++ == ETL_STRL(
'1'));
1147 size_t number_of_elements,
1149 const char16_t* text) ETL_NOEXCEPT
1151 if (text == ETL_NULLPTR)
1153 etl::fill_n(pbuffer, number_of_elements, All_Clear_Element);
1158 size_t index = etl::min(number_of_elements - 1U, (
string_length / Bits_Per_Element));
1161 while (index != number_of_elements)
1163 pbuffer[index++] = All_Clear_Element;
1171 set_position(pbuffer, --
i, *text++ == ETL_STRu(
'1'));
1182 size_t number_of_elements,
1184 const char32_t* text) ETL_NOEXCEPT
1186 if (text == ETL_NULLPTR)
1188 etl::fill_n(pbuffer, number_of_elements, All_Clear_Element);
1193 size_t index = etl::min(number_of_elements - 1U, (
string_length / Bits_Per_Element));
1196 while (index != number_of_elements)
1198 pbuffer[index++] = All_Clear_Element;
1206 set_position(pbuffer, --
i, *text++ == ETL_STRU(
'1'));
1217 size_t number_of_elements) ETL_NOEXCEPT
1219 while (number_of_elements-- != 0
U)
1221 *pbuffer++ = All_Clear_Element;
1231 size_t position) ETL_NOEXCEPT
1236 pbuffer[index] &=
~bit;
1242 template <
typename T>
1246 size_t number_of_elements) ETL_NOEXCEPT
1250 const bool OK = (
sizeof(
T) *
CHAR_BIT) >= (number_of_elements * Bits_Per_Element);
1256 for (
size_t i = 0
UL;
i < number_of_elements; ++
i)
1269 template <
typename T>
1275 size_t length) ETL_NOEXCEPT
1287 if (length >= Bits_Per_Element)
1289 value = value << Bits_Per_Element;
1295 while (length >= Bits_Per_Element)
1298 length -= Bits_Per_Element;
1299 if (length >= Bits_Per_Element)
1301 value = value << Bits_Per_Element;
1309 value = value << length;
1321 template <
typename T>
1326 size_t length) ETL_NOEXCEPT
1361 template <
typename T,
size_t Position,
size_t Length>
1380 template <
typename T,
size_t Position,
size_t Length>
1398 template <
typename T>
1414 return static_cast<T>(value);
1420 template <
typename T,
size_t Position,
size_t Length>
1434 return static_cast<T>(value);
1443 size_t number_of_elements) ETL_NOEXCEPT
1445 operator_not(pbuffer, number_of_elements);
1454 size_t position) ETL_NOEXCEPT
1459 pbuffer[index] ^=
bit;
1471 size_t number_of_elements,
1474 size_t position) ETL_NOEXCEPT
1478 size_t bit = position & (Bits_Per_Element - 1);
1483 while (index < number_of_elements)
1488 if ((state && (value != All_Clear_Element)) ||
1489 (!state && (value != All_Set_Element)))
1495 if (((value &
mask) != 0) == state)
1508 position += (Bits_Per_Element -
bit);
1524 template <
typename TString>
1529 typename TString::value_type
zero,
1530 typename TString::value_type
one)
1554 size_t number_of_elements) ETL_NOEXCEPT
1556 while (number_of_elements-- != 0)
1571 size_t number_of_elements) ETL_NOEXCEPT
1573 while (number_of_elements-- != 0)
1588 size_t number_of_elements) ETL_NOEXCEPT
1590 while (number_of_elements-- != 0)
1605 size_t number_of_elements) ETL_NOEXCEPT
1607 while (number_of_elements-- != 0)
1621 size_t number_of_elements) ETL_NOEXCEPT
1623 while (number_of_elements-- != 0)
1625 *pbuffer = ~*pbuffer;
1636 size_t number_of_elements,
1638 size_t shift) ETL_NOEXCEPT
1642 reset_all(pbuffer, number_of_elements);
1700 size_t number_of_elements,
1702 size_t shift) ETL_NOEXCEPT
1706 reset_all(pbuffer, number_of_elements);
1728 while (
src_index <
int(number_of_elements - 1))
1752 while (
dst_index <
int(number_of_elements))
1767 size_t number_of_elements) ETL_NOEXCEPT
1776 template <
typename TElementType>
1781 size_t number_of_elements,
1782 unsigned long long value) ETL_NOEXCEPT
1787 pbuffer[
i++] = value;
1790 while (
i != number_of_elements)
1792 pbuffer[
i++] = All_Clear_Element;
1800 template <
typename TElementType>
1805 size_t number_of_elements,
1806 unsigned long long value) ETL_NOEXCEPT
1813 while ((value != 0) && (
i != number_of_elements))
1815 pbuffer[
i++] = value & All_Set_Element;
1816 value = value >>
Shift;
1820 while (
i != number_of_elements)
1822 pbuffer[
i++] = All_Clear_Element;
1833 size_t number_of_elements)
1839 namespace private_bitset
1842 template <
size_t Active_Bits,
typename TElement>
1847 typedef typename etl::private_bitset::bitset_impl_common<TElement>::element_type
element_type;
1853 static ETL_CONSTANT
size_t Number_Of_Elements = (Active_Bits % Bits_Per_Element == 0) ? Active_Bits / Bits_Per_Element : Active_Bits / Bits_Per_Element + 1;
1854 static ETL_CONSTANT
size_t Size = Active_Bits;
1855 static ETL_CONSTANT
size_t Allocated_Bits = Number_Of_Elements * Bits_Per_Element;
1868 static ETL_CONSTANT
size_t Top_Mask_Shift = ((Bits_Per_Element - ((Number_Of_Elements * Bits_Per_Element) - Active_Bits)) % Bits_Per_Element);
1872 static ETL_CONSTANT
TElement Top_Mask =
element_type(Top_Mask_Shift == 0 ? All_Set_Element : ~(All_Set_Element << Top_Mask_Shift));
1876 template <
size_t Active_Bits,
typename TElement>
1879 template <
size_t Active_Bits,
typename TElement>
1883 template <
size_t Active_Bits,
typename TElement>
1886 template <
size_t Active_Bits,
typename TElement>
1890 template <
size_t Active_Bits,
typename TElement>
1893 template <
size_t Active_Bits,
typename TElement>
1900 template <
size_t Active_Bits = 0
U,
1929 template <
size_t Active_Bits,
typename TElement>
1962 : p_bitset(
other.p_bitset)
1963 , position(
other.position)
1972 return p_bitset->
test(position);
1980 p_bitset->
set(position,
b);
1989 p_bitset->
set(position,
bool(
r));
1998 p_bitset->
flip(position);
2007 return !p_bitset->
test(position);
2016 : p_bitset(ETL_NULLPTR)
2030 bitset<Active_Bits, TElement>* p_bitset;
2040 implementation::reset_all(buffer, Number_Of_Elements);
2049 implementation::operator_assignment(buffer,
other.buffer, Number_Of_Elements);
2055 template <
typename TValue>
2065 template <
typename TPString>
2069 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2075 template <
typename TPString>
2079 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2085 template <
typename TPString>
2089 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2095 template <
typename TPString>
2099 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2107 implementation::operator_assignment(buffer,
other.buffer, Number_Of_Elements);
2117 implementation::set_all(buffer, Number_Of_Elements, Top_Mask);
2128 ETL_ASSERT_OR_RETURN_VALUE(position < Active_Bits, ETL_ERROR(
bitset_overflow), *
this);
2130 implementation::set_position(buffer, position,
value);
2138 template <
size_t Position>
2141 ETL_STATIC_ASSERT(
Position < Active_Bits,
"Position out of bounds");
2151 template <
size_t Position,
bool Value>
2154 ETL_STATIC_ASSERT(
Position < Active_Bits,
"Position out of bounds");
2164 template <
typename TPString>
2169 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2177 template <
typename TPString>
2182 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2190 template <
typename TPString>
2195 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2203 template <
typename TPString>
2208 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2218 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2228 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2238 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2248 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2256 template <
typename T>
2271 template <
typename T>
2278 ETL_ASSERT_OR_RETURN_VALUE((position + length) <= Active_Bits, ETL_ERROR(
bitset_overflow), 0);
2290 template <
typename T,
size_t Position,
size_t Length>
2297 ETL_STATIC_ASSERT((
Position +
Length) <= Active_Bits,
"Position/Length overflows bitset");
2327 implementation::reset_all(buffer, Number_Of_Elements);
2337 ETL_ASSERT_OR_RETURN_VALUE(position < Active_Bits, ETL_ERROR(
bitset_overflow), *
this);
2339 implementation::reset_position(buffer, position);
2348 ETL_CONSTEXPR14
bool test(
size_t position)
const
2350 ETL_ASSERT_OR_RETURN_VALUE(position < Active_Bits, ETL_ERROR(
bitset_overflow),
false);
2352 return implementation::test(buffer, position);
2359 template <
size_t Position>
2362 ETL_STATIC_ASSERT(
Position < Active_Bits,
"Position out of bounds");
2364 return implementation::test(buffer,
Position);
2370 static ETL_CONSTEXPR
size_t size() ETL_NOEXCEPT
2380 return Number_Of_Elements;
2388 return All_Set_Element;
2396 return All_Clear_Element;
2404 return Bits_Per_Element;
2410 static ETL_CONSTEXPR element_type
top_mask() ETL_NOEXCEPT
2420 return Number_Of_Elements * Bits_Per_Element;
2430 return Storage_Model;
2438 return implementation::count(buffer, Number_Of_Elements);
2444 ETL_CONSTEXPR14
bool all()
const ETL_NOEXCEPT
2446 return implementation::all(buffer, Number_Of_Elements, Top_Mask);
2452 ETL_CONSTEXPR14
bool all(element_type mask)
const ETL_NOEXCEPT
2454 ETL_STATIC_ASSERT(Storage_Model == etl::bitset_storage_model::Single,
"Not supported for 'Multi' bitset storage model");
2456 return implementation::all(buffer, Number_Of_Elements, Top_Mask, mask);
2464 return implementation::none(buffer, Number_Of_Elements);
2470 ETL_CONSTEXPR14
bool none(element_type
mask)
const ETL_NOEXCEPT
2472 ETL_STATIC_ASSERT(Storage_Model == etl::bitset_storage_model::Single,
"Not supported for 'Multi' bitset storage model");
2474 return implementation::none(buffer, Number_Of_Elements,
mask);
2482 return implementation::any(buffer, Number_Of_Elements);
2488 ETL_CONSTEXPR14
bool any(element_type
mask)
const ETL_NOEXCEPT
2490 ETL_STATIC_ASSERT(Storage_Model == etl::bitset_storage_model::Single,
"Not supported for 'Multi' bitset storage model");
2492 return implementation::any(buffer, Number_Of_Elements,
mask);
2500 implementation::flip_all(buffer, Number_Of_Elements);
2510 ETL_ASSERT_OR_RETURN_VALUE(position < Active_Bits, ETL_ERROR(
bitset_overflow), *
this);
2512 implementation::flip_position(buffer, position);
2520 ETL_CONSTEXPR14
bool operator[] (
size_t position)
const ETL_NOEXCEPT
2522 return implementation::test(buffer, position);
2537 template <
typename TString = etl::
string<Active_Bits>>
2539 template <
typename TString>
2542 typename TString::value_type
one =
typename TString::value_type(
'1'))
const
2554 return implementation::find_next(buffer, Number_Of_Elements, Active_Bits, state, 0);
2563 ETL_CONSTEXPR14
size_t find_next(
bool state,
size_t position)
const ETL_NOEXCEPT
2565 return implementation::find_next(buffer, Number_Of_Elements, Active_Bits, state, position);
2575 implementation::operator_and(
temp.buffer,
other.buffer, Number_Of_Elements);
2585 implementation::operator_and(buffer,
other.buffer, Number_Of_Elements);
2597 implementation::operator_or(
temp.buffer,
other.buffer, Number_Of_Elements);
2607 implementation::operator_or(&buffer[0], &
other.buffer[0], Number_Of_Elements);
2619 implementation::operator_xor(
temp.buffer,
other.buffer, Number_Of_Elements);
2629 implementation::operator_xor(buffer,
other.buffer, Number_Of_Elements);
2641 implementation::flip_all(
temp.buffer, Number_Of_Elements);
2653 implementation::operator_shift_left(
temp.buffer, Number_Of_Elements, Active_Bits,
shift);
2663 if (
shift >= Active_Bits)
2665 implementation::reset_all(buffer, Number_Of_Elements);
2669 implementation::operator_shift_left(buffer, Number_Of_Elements, Active_Bits,
shift);
2682 implementation::operator_shift_right(
temp.buffer, Number_Of_Elements, Active_Bits,
shift);
2692 if (
shift >= Active_Bits)
2694 implementation::reset_all(buffer, Number_Of_Elements);
2698 implementation::operator_shift_right(buffer, Number_Of_Elements, Active_Bits,
shift);
2709 return implementation::operator_equality(
lhs.buffer,
rhs.buffer,
lhs.Number_Of_Elements);
2725 implementation::swap(buffer,
other.buffer, Number_Of_Elements);
2734 return span_type(buffer, Number_Of_Elements);
2752 element_type buffer[Number_Of_Elements];
2759 template <
size_t Active_Bits,
typename TElement>
2771 template<
size_t Active_Bits,
typename TElement>
2783 template<
size_t Active_Bits,
typename TElement>
2796template<
size_t Active_Bits,
typename TElement>
2799 return !(lhs == rhs);
2805template <
size_t Active_Bits,
typename TElement>
2817 template <
size_t Active_Bits = 0U,
2818 typename TElement =
unsigned char>
2846 template <
size_t Active_Bits,
typename TElement>
2875 friend class bitset_ext;
2881 : p_bitset(
other.p_bitset)
2882 , position(
other.position)
2891 return p_bitset->test(position);
2899 p_bitset->set(position,
b);
2908 p_bitset->set(position,
bool(
r));
2917 p_bitset->flip(position);
2926 return !p_bitset->test(position);
2935 : p_bitset(ETL_NULLPTR)
2949 bitset_ext<Active_Bits, TElement>* p_bitset;
2956 ETL_CONSTEXPR14
explicit bitset_ext(element_type* pbuffer_)
2960 implementation::reset_all(pbuffer, Number_Of_Elements);
2966 ETL_CONSTEXPR14
explicit bitset_ext(buffer_type& buffer)
2967 : pbuffer(buffer.data())
2970 implementation::reset_all(pbuffer, Number_Of_Elements);
2976 ETL_CONSTEXPR14 bitset_ext(
const bitset_ext<Active_Bits, TElement>& other, element_type* pbuffer_)
2980 implementation::operator_assignment(pbuffer, other.pbuffer, Number_Of_Elements);
2986 ETL_CONSTEXPR14 bitset_ext(
const bitset_ext<Active_Bits, TElement>& other, buffer_type& buffer) ETL_NOEXCEPT
2987 : pbuffer(buffer.data())
2989 implementation::operator_assignment(pbuffer, other.pbuffer, Number_Of_Elements);
2995 ETL_CONSTEXPR14 bitset_ext(
const bitset_ext<Active_Bits, TElement>& other) ETL_NOEXCEPT ETL_DELETE;
3000 ETL_CONSTEXPR14 bitset_ext(
unsigned long long value, element_type* pbuffer_)
3010 template <
typename TValue>
3011 ETL_CONSTEXPR14 bitset_ext(TValue value, buffer_type& buffer,
typename etl::enable_if<is_integral<TValue>::value>::type* = 0) ETL_NOEXCEPT
3012 : pbuffer(buffer.data())
3020 template <
typename TPString>
3021 ETL_CONSTEXPR14 bitset_ext(TPString text, element_type* pbuffer_,
typename etl::enable_if<is_same<TPString, const char*>::value>::type* = 0)
3025 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3031 template <
typename TPString>
3032 ETL_CONSTEXPR14 bitset_ext(TPString text, buffer_type& buffer,
typename etl::enable_if<is_same<TPString, const char*>::value>::type* = 0) ETL_NOEXCEPT
3033 : pbuffer(buffer.data())
3035 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3041 template <
typename TPString>
3042 ETL_CONSTEXPR14 bitset_ext(TPString text, element_type* pbuffer_,
typename etl::enable_if<is_same<TPString, const wchar_t*>::value>::type* = 0)
3046 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3052 template <
typename TPString>
3053 ETL_CONSTEXPR14 bitset_ext(TPString text, buffer_type& buffer,
typename etl::enable_if<is_same<TPString, const wchar_t*>::value>::type* = 0) ETL_NOEXCEPT
3054 : pbuffer(buffer.data())
3056 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3062 template <
typename TPString>
3063 ETL_CONSTEXPR14 bitset_ext(TPString text, element_type* pbuffer_,
typename etl::enable_if<is_same<TPString, const char16_t*>::value>::type* = 0)
3067 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3073 template <
typename TPString>
3074 ETL_CONSTEXPR14 bitset_ext(TPString text, buffer_type& buffer,
typename etl::enable_if<is_same<TPString, const char16_t*>::value>::type* = 0) ETL_NOEXCEPT
3075 : pbuffer(buffer.data())
3077 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3083 template <
typename TPString>
3084 ETL_CONSTEXPR14 bitset_ext(TPString text, element_type* pbuffer_,
typename etl::enable_if<is_same<TPString, const char32_t*>::value>::type* = 0)
3088 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3094 template <
typename TPString>
3095 ETL_CONSTEXPR14 bitset_ext(TPString text, buffer_type& buffer,
typename etl::enable_if<is_same<TPString, const char32_t*>::value>::type* = 0) ETL_NOEXCEPT
3096 : pbuffer(buffer.data())
3098 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3104 ETL_CONSTEXPR14 bitset_ext& operator =(
const bitset_ext<Active_Bits, TElement>& other) ETL_NOEXCEPT
3106 implementation::operator_assignment(pbuffer, other.pbuffer, Number_Of_Elements);
3114 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& set() ETL_NOEXCEPT
3116 implementation::set_all(pbuffer, Number_Of_Elements, Top_Mask);
3125 bitset_ext<Active_Bits, TElement>& set(
size_t position,
bool value =
true)
3127 ETL_ASSERT_OR_RETURN_VALUE(position < Active_Bits, ETL_ERROR(bitset_overflow), *
this);
3129 implementation::set_position(pbuffer, position, value);
3137 template <
size_t Position>
3138 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& set(
bool value =
true)
3140 ETL_STATIC_ASSERT(Position < Active_Bits,
"Position out of bounds");
3150 template <
size_t Position,
bool Value>
3151 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& set()
3153 ETL_STATIC_ASSERT(Position < Active_Bits,
"Position out of bounds");
3163 template <
typename TPString>
3166 set(TPString text) ETL_NOEXCEPT
3168 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3176 template <
typename TPString>
3179 set(TPString text) ETL_NOEXCEPT
3181 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3189 template <
typename TPString>
3192 set(TPString text) ETL_NOEXCEPT
3194 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3202 template <
typename TPString>
3205 set(TPString text) ETL_NOEXCEPT
3207 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3215 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& from_string(
const char* text) ETL_NOEXCEPT
3217 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3225 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& from_string(
const wchar_t* text) ETL_NOEXCEPT
3227 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3235 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& from_string(
const char16_t* text) ETL_NOEXCEPT
3237 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3245 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& from_string(
const char32_t* text) ETL_NOEXCEPT
3247 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3255 template <
typename T>
3257 T value() const ETL_NOEXCEPT
3269 template <
typename T>
3276 ETL_ASSERT_OR_RETURN_VALUE((position + length) <= Active_Bits, ETL_ERROR(bitset_overflow), 0);
3286 template <typename T, size_t Position, size_t Length = etl::integral_limits<T>::bits>
3288 template <
typename T,
size_t Position,
size_t Length>
3295 ETL_STATIC_ASSERT((Position + Length) <= Active_Bits,
"Position/Length overflows bitset");
3303 unsigned long to_ulong()
const
3313 unsigned long long to_ullong()
const
3323 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& reset() ETL_NOEXCEPT
3325 implementation::reset_all(pbuffer, Number_Of_Elements);
3333 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& reset(
size_t position)
3335 ETL_ASSERT_OR_RETURN_VALUE(position < Active_Bits, ETL_ERROR(bitset_overflow), *
this);
3337 implementation::reset_position(pbuffer, position);
3346 ETL_CONSTEXPR14
bool test(
size_t position)
const
3348 ETL_ASSERT_OR_RETURN_VALUE(position < Active_Bits, ETL_ERROR(bitset_overflow),
false);
3350 return implementation::test(pbuffer, position);
3357 template <
size_t Position>
3358 ETL_CONSTEXPR14
bool test()
const
3360 ETL_STATIC_ASSERT(Position < Active_Bits,
"Position out of bounds");
3362 return implementation::test(pbuffer, Position);
3368 static ETL_CONSTEXPR
size_t size() ETL_NOEXCEPT
3376 static ETL_CONSTEXPR
size_t number_of_elements() ETL_NOEXCEPT
3378 return Number_Of_Elements;
3384 static ETL_CONSTEXPR element_type all_set_element() ETL_NOEXCEPT
3386 return All_Set_Element;
3392 static ETL_CONSTEXPR element_type all_clear_element() ETL_NOEXCEPT
3394 return All_Clear_Element;
3400 static ETL_CONSTEXPR element_type top_mask() ETL_NOEXCEPT
3408 static ETL_CONSTEXPR
size_t bits_per_element() ETL_NOEXCEPT
3410 return Bits_Per_Element;
3416 static ETL_CONSTEXPR
size_t allocated_bits() ETL_NOEXCEPT
3418 return Number_Of_Elements * Bits_Per_Element;
3428 return Storage_Model;
3434 ETL_CONSTEXPR14
size_t count() const ETL_NOEXCEPT
3436 return implementation::count(pbuffer, Number_Of_Elements);
3442 ETL_CONSTEXPR14
bool all() const ETL_NOEXCEPT
3444 return implementation::all(pbuffer, Number_Of_Elements, Top_Mask);
3450 ETL_CONSTEXPR14
bool all(element_type mask)
const ETL_NOEXCEPT
3452 ETL_STATIC_ASSERT(Storage_Model == etl::bitset_storage_model::Single,
"Not supported for 'Multi' bitset storage model");
3454 return implementation::all(pbuffer, Number_Of_Elements, Top_Mask, mask);
3460 ETL_CONSTEXPR14
bool none() const ETL_NOEXCEPT
3462 return implementation::none(pbuffer, Number_Of_Elements);
3468 ETL_CONSTEXPR14
bool none(element_type mask)
const ETL_NOEXCEPT
3470 ETL_STATIC_ASSERT(Storage_Model == etl::bitset_storage_model::Single,
"Not supported for 'Multi' bitset storage model");
3472 return implementation::none(pbuffer, Number_Of_Elements, mask);
3478 ETL_CONSTEXPR14
bool any() const ETL_NOEXCEPT
3480 return implementation::any(pbuffer, Number_Of_Elements);
3486 ETL_CONSTEXPR14
bool any(element_type mask)
const ETL_NOEXCEPT
3488 ETL_STATIC_ASSERT(Storage_Model == etl::bitset_storage_model::Single,
"Not supported for 'Multi' bitset storage model");
3490 return implementation::any(pbuffer, Number_Of_Elements, mask);
3496 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& flip() ETL_NOEXCEPT
3498 implementation::flip_all(pbuffer, Number_Of_Elements);
3506 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& flip(
size_t position)
3508 ETL_ASSERT_OR_RETURN_VALUE(position < Active_Bits, ETL_ERROR(bitset_overflow), *
this);
3510 implementation::flip_position(pbuffer, position);
3518 ETL_CONSTEXPR14
bool operator[] (
size_t position)
const ETL_NOEXCEPT
3520 return implementation::test(pbuffer, position);
3526 ETL_CONSTEXPR14 bit_reference operator [] (
size_t position) ETL_NOEXCEPT
3528 return bit_reference(*
this, position);
3535 template <
typename TString = etl::
string<Active_Bits>>
3537 template <
typename TString>
3539 ETL_CONSTEXPR14 TString
to_string(
typename TString::value_type zero =
typename TString::value_type(
'0'),
3540 typename TString::value_type one =
typename TString::value_type(
'1'))
const
3550 ETL_CONSTEXPR14
size_t find_first(
bool state)
const ETL_NOEXCEPT
3552 return implementation::find_next(pbuffer, Number_Of_Elements, Active_Bits, state, 0);
3561 ETL_CONSTEXPR14
size_t find_next(
bool state,
size_t position)
const ETL_NOEXCEPT
3563 return implementation::find_next(pbuffer, Number_Of_Elements, Active_Bits, state, position);
3569 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& operator &=(
const bitset_ext<Active_Bits, TElement>& other) ETL_NOEXCEPT
3571 implementation::operator_and(&pbuffer[0], &other.pbuffer[0], Number_Of_Elements);
3579 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& operator |=(
const bitset_ext<Active_Bits, TElement>& other) ETL_NOEXCEPT
3581 implementation::operator_or(&pbuffer[0], &other.pbuffer[0], Number_Of_Elements);
3589 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& operator ^=(
const bitset_ext<Active_Bits, TElement>& other) ETL_NOEXCEPT
3591 implementation::operator_xor(&pbuffer[0], &other.pbuffer[0], Number_Of_Elements);
3599 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& operator <<=(
size_t shift) ETL_NOEXCEPT
3601 implementation::operator_shift_left(pbuffer, Number_Of_Elements, Active_Bits, shift);
3609 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& operator >>=(
size_t shift) ETL_NOEXCEPT
3611 implementation::operator_shift_right(pbuffer, Number_Of_Elements, Active_Bits, shift);
3619 friend ETL_CONSTEXPR14
bool operator ==(
const bitset_ext<Active_Bits, TElement>& lhs,
const bitset_ext<Active_Bits, TElement>& rhs) ETL_NOEXCEPT
3621 return implementation::operator_equality(lhs.pbuffer, rhs.pbuffer, lhs.Number_Of_Elements);
3627 friend ETL_CONSTEXPR14
bool operator !=(
const bitset_ext<Active_Bits, TElement>& lhs,
const bitset_ext<Active_Bits, TElement>& rhs) ETL_NOEXCEPT
3629 return !(lhs == rhs);
3637 implementation::swap(pbuffer, other.pbuffer, Number_Of_Elements);
3644 ETL_CONSTEXPR14 span_type span() ETL_NOEXCEPT
3646 return span_type(pbuffer, Number_Of_Elements);
3653 ETL_CONSTEXPR14 const_span_type span() const ETL_NOEXCEPT
3655 return const_span_type(pbuffer, Number_Of_Elements);
3661 typedef etl::bitset_impl<element_type, (Number_Of_Elements == 1U) ? etl::bitset_storage_model::Single :
etl::bitset_storage_model::Multi> implementation;
3664 element_type* pbuffer;
3672template<
size_t Active_Bits,
typename TElement>
3675 return !(lhs == rhs);
3681template <
size_t Active_Bits,
typename TElement>
3689 namespace private_bitset
3695 template <
typename TLhsSpan,
typename TRhsSpan>
3696 bool compare_bitset_spans(
const TLhsSpan& lhs_span,
const TRhsSpan& rhs_span)
3698 typedef typename TLhsSpan::value_type lhs_element_t;
3699 typedef typename TRhsSpan::value_type rhs_element_t;
3701 const int steps =
static_cast<int>(
sizeof(lhs_element_t) /
sizeof(rhs_element_t));
3703 typename TLhsSpan::iterator lhs_itr = lhs_span.begin();
3704 typename TRhsSpan::iterator rhs_itr = rhs_span.begin();
3706 while (lhs_itr != lhs_span.end())
3708 const lhs_element_t& lhs_value = *lhs_itr;
3711 lhs_element_t rhs_value = 0;
3716 for (
int i = 0; i < steps; ++i)
3718 rhs_value |= (
static_cast<lhs_element_t
>(*rhs_itr) << shift);
3720 shift += shift_step;
3723 if (lhs_value != rhs_value)
3742template<
size_t Active_Bits,
typename TLhsElement,
typename TRhsElement>
3752 if ETL_IF_CONSTEXPR(
sizeof(TLhsElement) >
sizeof(TRhsElement))
3754 return etl::private_bitset::compare_bitset_spans(lhs_span, rhs_span);
3758 return etl::private_bitset::compare_bitset_spans(rhs_span, lhs_span);
3768template<
size_t Active_Bits,
typename TLhsElement,
typename TRhsElement>
3773 return !(lhs == rhs);
3782template<
size_t Active_Bits,
typename TLhsElement,
typename TRhsElement>
3792 if ETL_IF_CONSTEXPR(
sizeof(TLhsElement) >
sizeof(TRhsElement))
3794 return etl::private_bitset::compare_bitset_spans(lhs_span, rhs_span);
3798 return etl::private_bitset::compare_bitset_spans(rhs_span, lhs_span);
3808template<
size_t Active_Bits,
typename TLhsElement,
typename TRhsElement>
3813 return !(lhs == rhs);
3821template<
size_t Active_Bits,
typename TElement>
3833 return implementation::operator_equality(lhs_span.begin(), rhs_span.begin(), Number_Of_Elements);
3841template<
size_t Active_Bits,
typename TElement>
3845 return !(lhs == rhs);
3853template<
size_t Active_Bits,
typename TElement>
3865 return implementation::operator_equality(lhs_span.begin(), rhs_span.begin(), Number_Of_Elements);
3873template<
size_t Active_Bits,
typename TElement>
3877 return !(lhs == rhs);
3885template<
size_t Active_Bits,
typename TLhsElement,
typename TRhsElement>
3895 if ETL_IF_CONSTEXPR(
sizeof(TLhsElement) >
sizeof(TRhsElement))
3897 return etl::private_bitset::compare_bitset_spans(lhs_span, rhs_span);
3901 return etl::private_bitset::compare_bitset_spans(rhs_span, lhs_span);
3910template<
size_t Active_Bits,
typename TLhsElement,
typename TRhsElement>
3915 return !(lhs == rhs);
3923template<
size_t Active_Bits,
typename TLhsElement,
typename TRhsElement>
3933 if ETL_IF_CONSTEXPR(
sizeof(TLhsElement) >
sizeof(TRhsElement))
3935 return etl::private_bitset::compare_bitset_spans(lhs_span, rhs_span);
3939 return etl::private_bitset::compare_bitset_spans(rhs_span, lhs_span);
3948template<
size_t Active_Bits,
typename TLhsElement,
typename TRhsElement>
3953 return !(lhs == rhs);
The reference type returned.
Definition bitset_new.h:1953
ETL_CONSTEXPR14 bit_reference(const bit_reference &other) ETL_NOEXCEPT
Copy constructor.
Definition bitset_new.h:1961
ETL_CONSTEXPR14 bit_reference & operator=(bool b) ETL_NOEXCEPT
Assignment operator.
Definition bitset_new.h:1978
ETL_CONSTEXPR14 bit_reference & flip() ETL_NOEXCEPT
Flip the bit.
Definition bitset_new.h:1996
ETL_CONSTEXPR14 bool operator~() const ETL_NOEXCEPT
Return the logical inverse of the bit.
Definition bitset_new.h:2005
The reference type returned.
Definition bitset_new.h:2872
ETL_CONSTEXPR14 bit_reference & operator=(bool b) ETL_NOEXCEPT
Assignment operator.
Definition bitset_new.h:2897
ETL_CONSTEXPR14 bit_reference & flip() ETL_NOEXCEPT
Flip the bit.
Definition bitset_new.h:2915
ETL_CONSTEXPR14 bool operator~() const ETL_NOEXCEPT
Return the logical inverse of the bit.
Definition bitset_new.h:2924
ETL_CONSTEXPR14 bit_reference(const bit_reference &other) ETL_NOEXCEPT
Copy constructor.
Definition bitset_new.h:2880
Definition bitset_new.h:1844
Definition bitset_new.h:168
ETL_CONSTEXPR14 bool operator==(const etl::expected< TValue, TError > &lhs, const etl::expected< TValue2, TError2 > &rhs)
Equivalence operators.
Definition expected.h:966
ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value &&etl::is_unsigned< T >::value &&(etl::integral_limits< T >::bits==16U), uint_least8_t >::type count_bits(T value)
Definition binary.h:922
static ETL_CONSTEXPR14 bool operator_equality(const_pointer lhs_pbuffer, const_pointer rhs_pbuffer, size_t number_of_elements) ETL_NOEXCEPT
operator_equality
Definition bitset_new.h:1765
static ETL_CONSTEXPR14 etl::make_unsigned< T >::type extract_from_multiple_elements(const element_type *pbuffer, int element_index, size_t active_bits_in_msb, size_t length) ETL_NOEXCEPT
Extract an value from multiple elements.
Definition bitset_new.h:1272
ETL_CONSTEXPR14 bool none(element_type mask) const ETL_NOEXCEPT
Are none of the mask bits set?
Definition bitset_new.h:2470
static ETL_CONSTEXPR14 T extract(const_pointer pbuffer)
Extract an integral value from an arbitrary position and length.
Definition bitset_new.h:1423
bitset< MaxN > & operator&=(const bitset< MaxN > &other)
operator &=
Definition bitset_legacy.h:1389
ETL_CONSTEXPR14 size_t find_next(bool state, size_t position) const ETL_NOEXCEPT
Definition bitset_new.h:2563
static ETL_CONSTEXPR14 size_t find_next(const_pointer pbuffer, size_t number_of_elements, size_t total_bits, bool state, size_t position) ETL_NOEXCEPT
Definition bitset_new.h:1470
ETL_CONSTEXPR14 T extract(size_t position, size_t length=etl::integral_limits< T >::bits) const
Definition bitset_new.h:2273
static ETL_CONSTEXPR14 void set_all(pointer pbuffer, size_t number_of_elements, element_type top_mask) ETL_NOEXCEPT
Set all bits.
Definition bitset_new.h:994
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > & set(size_t position, bool value=true)
Set the bit at the position.
Definition bitset_new.h:2126
static ETL_CONSTEXPR14 etl::enable_if< value_is_in_one_element< Position, Length, Bits_Per_Element >::value, typenameetl::make_unsigned< T >::type >::type extract_from_buffer(const_pointer pbuffer)
Definition bitset_new.h:1365
static ETL_CONSTEXPR14 etl::make_unsigned< T >::type extract_from_buffer(const_pointer pbuffer, size_t position, size_t length) ETL_NOEXCEPT
Definition bitset_new.h:1324
ETL_CONSTEXPR14 bitset(const bitset< Active_Bits, TElement > &other) ETL_NOEXCEPT
Copy constructor.
Definition bitset_new.h:2046
static ETL_CONSTEXPR14 void swap(pointer lhs_pbuffer, pointer rhs_pbuffer, size_t) ETL_NOEXCEPT
swap
Definition bitset_new.h:846
ETL_CONSTEXPR14 etl::enable_if< etl::is_same< TPString, constchar16_t * >::value, bitset< Active_Bits, TElement > & >::type set(TPString text) ETL_NOEXCEPT
Set from a char16 string.
Definition bitset_new.h:2193
friend bool operator==(const bitset< MaxN > &lhs, const bitset< MaxN > &rhs)
operator ==
Definition bitset_legacy.h:1470
static ETL_CONSTEXPR14 void reset_position(pointer pbuffer, size_t position)
Reset the bit at the position.
Definition bitset_new.h:311
static ETL_CONSTEXPR14 void flip_all(pointer pbuffer, size_t) ETL_NOEXCEPT
Flip all of the bits.
Definition bitset_new.h:614
static ETL_CONSTEXPR14 etl::enable_if<!value_is_in_one_element< Position, Length, Bits_Per_Element >::value, typenameetl::make_unsigned< T >::type >::type extract_from_buffer(const_pointer pbuffer)
Definition bitset_new.h:1384
static ETL_CONSTEXPR14 bool any(const_pointer pbuffer, size_t, element_type mask) ETL_NOEXCEPT
Are any of the mask bits set?
Definition bitset_new.h:602
static ETL_CONSTEXPR element_type all_set_element() ETL_NOEXCEPT
The value of a set element.
Definition bitset_new.h:2386
static ETL_CONSTEXPR14 void set_position(pointer pbuffer, size_t position, bool value=true)
Set the bit at the position.
Definition bitset_new.h:237
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > & from_string(const char32_t *text) ETL_NOEXCEPT
Set from a u32 string.
Definition bitset_new.h:2246
bitset< MaxN > & flip()
Flip all of the bits.
Definition bitset_legacy.h:1334
static ETL_CONSTEXPR14 void from_string(pointer pbuffer, size_t number_of_elements, size_t total_bits, const char *text) ETL_NOEXCEPT
Set from a string.
Definition bitset_new.h:1076
static ETL_CONSTEXPR14 T extract(const_pointer pbuffer)
Extract an integral value from an arbitrary position and length.
Definition bitset_new.h:497
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > & from_string(const char16_t *text) ETL_NOEXCEPT
Set from a u16 string.
Definition bitset_new.h:2236
static ETL_CONSTEXPR14 void flip_all(pointer pbuffer, size_t number_of_elements) ETL_NOEXCEPT
Flip all of the bits.
Definition bitset_new.h:1442
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > & set() ETL_NOEXCEPT
Set all of the bits.
Definition bitset_new.h:2115
static ETL_CONSTEXPR14 size_t find_next(const_pointer pbuffer, size_t, size_t active_bits, bool state, size_t position) ETL_NOEXCEPT
Definition bitset_new.h:677
static ETL_CONSTEXPR14 void initialise(pointer pbuffer, size_t, unsigned long long value) ETL_NOEXCEPT
Initialise from an unsigned long long.
Definition bitset_new.h:834
static ETL_CONSTEXPR14 TString to_string(const_pointer pbuffer, size_t active_bits, typename TString::value_type zero, typename TString::value_type one)
Returns a string representing the bitset.
Definition bitset_new.h:1527
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > & flip() ETL_NOEXCEPT
Flip all of the bits.
Definition bitset_new.h:2498
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > & from_string(const char *text) ETL_NOEXCEPT
Set from a string.
Definition bitset_new.h:2216
ETL_CONSTEXPR14 const_span_type span() const ETL_NOEXCEPT
Definition bitset_new.h:2741
static ETL_CONSTEXPR14 void from_string(pointer pbuffer, size_t number_of_elements, size_t total_bits, const wchar_t *text) ETL_NOEXCEPT
Set from a wide string.
Definition bitset_new.h:1111
ETL_CONSTEXPR14 bool none() const ETL_NOEXCEPT
Are none of the bits set?
Definition bitset_new.h:2462
ETL_CONSTEXPR14 bitset(TPString text, typename etl::enable_if< is_same< TPString, const char16_t * >::value >::type *=0) ETL_NOEXCEPT
Construct from a string.
Definition bitset_new.h:2086
static ETL_CONSTEXPR14 void flip_position(pointer pbuffer, size_t position)
Flip the bit at the position.
Definition bitset_new.h:636
static ETL_CONSTEXPR14 void from_string(pointer pbuffer, size_t number_of_elements, size_t total_bits, const char16_t *text) ETL_NOEXCEPT
Set from a u16 string.
Definition bitset_new.h:1146
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > operator&(const bitset< Active_Bits, TElement > &other) const ETL_NOEXCEPT
operator &
Definition bitset_new.h:2571
static ETL_CONSTEXPR14 void set_position(pointer pbuffer, bool value=true)
Set the bit at the position.
Definition bitset_new.h:1034
static ETL_CONSTEXPR14 void operator_assignment(pointer lhs_pbuffer, const_pointer rhs_pbuffer, size_t number_of_elements) ETL_NOEXCEPT
operator assignment
Definition bitset_new.h:1552
static ETL_CONSTEXPR14 bool none(const_pointer pbuffer, size_t, element_type mask) ETL_NOEXCEPT
Are none of the mask bits set?
Definition bitset_new.h:579
ETL_CONSTEXPR14 size_t find_first(bool state) const ETL_NOEXCEPT
Definition bitset_new.h:2552
static ETL_CONSTEXPR14 void set_position(pointer pbuffer)
Set the bit at the position.
Definition bitset_new.h:1056
ETL_CONSTEXPR14 bitset(TValue value, typename etl::enable_if< is_integral< TValue >::value >::type *=0) ETL_NOEXCEPT
Construct from a value.
Definition bitset_new.h:2056
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > & from_string(const wchar_t *text) ETL_NOEXCEPT
Set from a wide string.
Definition bitset_new.h:2226
static ETL_CONSTEXPR14 void operator_and(pointer lhs_pbuffer, const_pointer rhs_pbuffer, size_t number_of_elements) ETL_NOEXCEPT
operator and
Definition bitset_new.h:1569
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > & flip(size_t position)
Flip the bit at the position.
Definition bitset_new.h:2508
etl::enable_if< etl::is_integral< T >::value, T >::type value() const
Put to a value.
Definition bitset_legacy.h:1305
static ETL_CONSTEXPR size_t number_of_elements() ETL_NOEXCEPT
The number of storage elements in the bitset.
Definition bitset_new.h:2378
static ETL_CONSTEXPR14 size_t count(const_pointer pbuffer, size_t number_of_elements) ETL_NOEXCEPT
Count the number of bits set.
Definition bitset_new.h:908
static ETL_CONSTEXPR14 void operator_or(pointer lhs_pbuffer, const_pointer rhs_pbuffer, size_t) ETL_NOEXCEPT
Definition bitset_new.h:744
ETL_CONSTEXPR14 void swap(etl::bitset< Active_Bits, TElement > &other) ETL_NOEXCEPT
swap
Definition bitset_new.h:2723
static ETL_CONSTEXPR14 T extract(const_pointer pbuffer, size_t position, size_t length=etl::integral_limits< T >::bits)
Extract an integral value from an arbitrary position and length.
Definition bitset_new.h:1401
ETL_CONSTEXPR14 TString to_string(typename TString::value_type zero=typename TString::value_type('0'), typename TString::value_type one=typename TString::value_type('1')) const
Returns a string representing the bitset.
Definition bitset_new.h:2541
static ETL_CONSTEXPR14 void from_string(pointer pbuffer, size_t, size_t active_bits, const wchar_t *text) ETL_NOEXCEPT
Set from a wide string.
Definition bitset_new.h:356
static ETL_CONSTEXPR size_t allocated_bits() ETL_NOEXCEPT
The total number of bits of storage, including unused.
Definition bitset_new.h:2418
static ETL_CONSTEXPR14 void operator_shift_left(pointer pbuffer, size_t number_of_elements, size_t active_bits, size_t shift) ETL_NOEXCEPT
operator_shift_left
Definition bitset_new.h:1635
static ETL_CONSTEXPR element_type top_mask() ETL_NOEXCEPT
The mask for the msb element.
Definition bitset_new.h:2410
static ETL_CONSTEXPR14 void operator_or(pointer lhs_pbuffer, const_pointer rhs_pbuffer, size_t number_of_elements) ETL_NOEXCEPT
operator or
Definition bitset_new.h:1586
static ETL_CONSTEXPR14 void operator_shift_right(pointer pbuffer, size_t, size_t active_bits, size_t shift) ETL_NOEXCEPT
operator_shift_right
Definition bitset_new.h:801
ETL_CONSTEXPR14 bool test(size_t position) const
Definition bitset_new.h:2348
ETL_CONSTEXPR14 etl::enable_if< etl::is_integral< T >::value, T >::type value() const ETL_NOEXCEPT
Get as an integral value.
Definition bitset_new.h:2259
static ETL_CONSTEXPR14 bool any(const_pointer pbuffer, size_t) ETL_NOEXCEPT
Are any of the bits set?
Definition bitset_new.h:591
ETL_CONSTEXPR14 bool any(element_type mask) const ETL_NOEXCEPT
Are any of the mask bits set?
Definition bitset_new.h:2488
ETL_CONSTEXPR14 bitset(TPString text, typename etl::enable_if< is_same< TPString, const char32_t * >::value >::type *=0) ETL_NOEXCEPT
Construct from a string.
Definition bitset_new.h:2096
static ETL_CONSTEXPR element_type all_clear_element() ETL_NOEXCEPT
The value of a clear element.
Definition bitset_new.h:2394
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > & reset() ETL_NOEXCEPT
Reset all of the bits.
Definition bitset_new.h:2325
static ETL_CONSTEXPR14 void reset_all(pointer pbuffer, size_t number_of_elements) ETL_NOEXCEPT
Reset all of the bits.
Definition bitset_new.h:1216
static ETL_CONSTEXPR14 void from_string(pointer pbuffer, size_t, size_t active_bits, const char *text) ETL_NOEXCEPT
Set from a string.
Definition bitset_new.h:323
bitset< MaxN > & operator<<=(size_t shift)
operator <<=
Definition bitset_legacy.h:1440
bitset< MaxN > operator<<(size_t shift) const
operator <<
Definition bitset_legacy.h:1428
static ETL_CONSTEXPR14 void operator_shift_left(pointer pbuffer, size_t, size_t active_bits, size_t shift) ETL_NOEXCEPT
operator_shift_left
Definition bitset_new.h:781
static ETL_CONSTEXPR14 void operator_xor(pointer lhs_pbuffer, const_pointer rhs_pbuffer, size_t) ETL_NOEXCEPT
Definition bitset_new.h:757
static ETL_CONSTEXPR14 T value(const_pointer pbuffer, size_t number_of_elements) ETL_NOEXCEPT
Get as a value.
Definition bitset_new.h:1245
static ETL_CONSTEXPR14 void flip_bits(pointer pbuffer, element_type mask=etl::integral_limits< element_type >::max) ETL_NOEXCEPT
Flip some of the bits.
Definition bitset_new.h:625
static ETL_CONSTEXPR14 bool none(const_pointer pbuffer, size_t number_of_elements) ETL_NOEXCEPT
Are none of the bits set?
Definition bitset_new.h:953
static ETL_CONSTEXPR14 void flip_position(pointer pbuffer, size_t position) ETL_NOEXCEPT
Flip the bit at the position.
Definition bitset_new.h:1453
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > operator|(const bitset< Active_Bits, TElement > &other) const ETL_NOEXCEPT
operator |
Definition bitset_new.h:2593
static ETL_CONSTEXPR14 void set_position(pointer pbuffer, size_t position, bool value=true) ETL_NOEXCEPT
Set the bit at the position.
Definition bitset_new.h:1011
static ETL_CONSTEXPR14 void swap(pointer pbuffer1, pointer pbuffer2, size_t number_of_elements)
Swap bitset buffers.
Definition bitset_new.h:1831
static ETL_CONSTEXPR14 void operator_not(pointer pbuffer, size_t number_of_elements) ETL_NOEXCEPT
operator not
Definition bitset_new.h:1620
bitset< MaxN > & operator|=(const bitset< MaxN > &other)
operator |=
Definition bitset_legacy.h:1398
static ETL_CONSTEXPR size_t bits_per_element() ETL_NOEXCEPT
The number of bits in an element.
Definition bitset_new.h:2402
ETL_CONSTEXPR14 size_t count() const ETL_NOEXCEPT
Count the number of bits set.
Definition bitset_new.h:2436
static ETL_CONSTEXPR14 etl::enable_if< etl::integral_limits< TElementType >::bits==etl::integral_limits< unsignedlonglong >::bits, void >::type initialise(pointer pbuffer, size_t number_of_elements, unsigned long long value) ETL_NOEXCEPT
Definition bitset_new.h:1780
bitset< MaxN > operator~() const
operator ~
Definition bitset_legacy.h:1416
static ETL_CONSTEXPR14 T value(const_pointer pbuffer, size_t) ETL_NOEXCEPT
Get as an integral value.
Definition bitset_new.h:456
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > & set(bool value=true)
Set the bit at the position.
Definition bitset_new.h:2139
friend ETL_CONSTEXPR14 bool operator!=(const bitset< Active_Bits, TElement > &lhs, const bitset< Active_Bits, TElement > &rhs) ETL_NOEXCEPT
operator !=
Definition bitset_new.h:2715
ETL_CONSTEXPR14 bool operator[](size_t position) const ETL_NOEXCEPT
Read [] operator.
Definition bitset_new.h:2520
static ETL_CONSTEXPR14 void reset_all(pointer pbuffer, size_t) ETL_NOEXCEPT
Reset all of the bits.
Definition bitset_new.h:299
ETL_CONSTEXPR14 bitset(TPString text, typename etl::enable_if< is_same< TPString, const wchar_t * >::value >::type *=0) ETL_NOEXCEPT
Construct from a string.
Definition bitset_new.h:2076
ETL_CONSTEXPR14 etl::enable_if< etl::is_same< TPString, constchar * >::value, bitset< Active_Bits, TElement > & >::type set(TPString text) ETL_NOEXCEPT
Set from a string.
Definition bitset_new.h:2167
bitset< MaxN > operator>>(size_t shift) const
operator >>
Definition bitset_legacy.h:1449
static ETL_CONSTEXPR14 bool any(const_pointer pbuffer, size_t number_of_elements) ETL_NOEXCEPT
Are any of the bits set?
Definition bitset_new.h:972
static ETL_CONSTEXPR14 bool test(const_pointer pbuffer, size_t position)
Definition bitset_new.h:520
static ETL_CONSTEXPR14 void reset_position(pointer pbuffer, size_t position) ETL_NOEXCEPT
Reset the bit at the position.
Definition bitset_new.h:1230
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > operator^(const bitset< Active_Bits, TElement > &other) const ETL_NOEXCEPT
operator ^
Definition bitset_new.h:2615
static ETL_CONSTEXPR14 void set_all(pointer pbuffer, size_t, element_type top_mask) ETL_NOEXCEPT
Set all of the bits.
Definition bitset_new.h:225
static ETL_CONSTEXPR14 bool none(const_pointer pbuffer, size_t) ETL_NOEXCEPT
Are none of the bits set?
Definition bitset_new.h:568
static ETL_CONSTEXPR14 void from_string(pointer pbuffer, size_t number_of_elements, size_t total_bits, const char32_t *text) ETL_NOEXCEPT
Set from a u32 string.
Definition bitset_new.h:1181
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > & reset(size_t position)
Reset the bit at the position.
Definition bitset_new.h:2335
ETL_CONSTEXPR14 etl::enable_if< etl::is_same< TPString, constwchar_t * >::value, bitset< Active_Bits, TElement > & >::type set(TPString text) ETL_NOEXCEPT
Set from a wide string.
Definition bitset_new.h:2180
static ETL_CONSTEXPR size_t size() ETL_NOEXCEPT
The number of bits in the bitset.
Definition bitset_new.h:2370
bitset< MaxN > & operator=(const bitset< MaxN > &other)
operator =
Definition bitset_legacy.h:1376
ETL_CONSTEXPR14 bitset(TPString text, typename etl::enable_if< is_same< TPString, const char * >::value >::type *=0) ETL_NOEXCEPT
Construct from a string.
Definition bitset_new.h:2066
static ETL_CONSTEXPR14 void from_string(pointer pbuffer, size_t, size_t active_bits, const char32_t *text) ETL_NOEXCEPT
Set from a u32 string.
Definition bitset_new.h:422
static ETL_CONSTEXPR14 void operator_shift_right(pointer pbuffer, size_t number_of_elements, size_t active_bits, size_t shift) ETL_NOEXCEPT
operator_shift_right
Definition bitset_new.h:1699
bitset< MaxN > & operator^=(const bitset< MaxN > &other)
operator ^=
Definition bitset_legacy.h:1407
static ETL_CONSTEXPR14 void operator_and(pointer lhs_pbuffer, const_pointer rhs_pbuffer, size_t) ETL_NOEXCEPT
Definition bitset_new.h:731
static ETL_CONSTEXPR14 void set_position(pointer pbuffer)
Set the bit at the position.
Definition bitset_new.h:280
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > & set()
Set the bit at the position.
Definition bitset_new.h:2152
static ETL_CONSTEXPR14 T extract(const_pointer pbuffer, size_t position, size_t length=etl::integral_limits< T >::bits)
Extract an integral value from an arbitrary position and length.
Definition bitset_new.h:468
unsigned long long to_ullong() const
Get as an unsigned long long.
Definition bitset_new.h:2315
ETL_CONSTEXPR14 bool any() const ETL_NOEXCEPT
Are any of the bits set?
Definition bitset_new.h:2480
static ETL_CONSTEXPR14 bool operator_equality(const_pointer lhs_pbuffer, const_pointer rhs_pbuffer, size_t) ETL_NOEXCEPT
operator_equality
Definition bitset_new.h:821
ETL_CONSTEXPR14 bool test() const
Definition bitset_new.h:2360
ETL_CONSTEXPR14 span_type span() ETL_NOEXCEPT
Definition bitset_new.h:2732
static ETL_CONSTEXPR14 void from_string(pointer pbuffer, size_t, size_t active_bits, const char16_t *text) ETL_NOEXCEPT
Set from a u16 string.
Definition bitset_new.h:389
static ETL_CONSTEXPR14 void set_position(pointer pbuffer, bool value=true)
Set the bit at the position.
Definition bitset_new.h:259
unsigned long to_ulong() const
Get as an unsigned long.
Definition bitset_new.h:2305
static ETL_CONSTEXPR14 void operator_xor(pointer lhs_pbuffer, const_pointer rhs_pbuffer, size_t number_of_elements) ETL_NOEXCEPT
operator xor
Definition bitset_new.h:1603
static ETL_CONSTEXPR14 etl::enable_if< etl::integral_limits< TElementType >::bits!=etl::integral_limits< unsignedlonglong >::bits, void >::type initialise(pointer pbuffer, size_t number_of_elements, unsigned long long value) ETL_NOEXCEPT
Definition bitset_new.h:1804
static ETL_CONSTEXPR14 size_t count(const_pointer pbuffer, size_t) ETL_NOEXCEPT
Count the number of bits set.
Definition bitset_new.h:532
static ETL_CONSTEXPR14 void operator_assignment(pointer lhs_pbuffer, const_pointer rhs_pbuffer, size_t) ETL_NOEXCEPT
Definition bitset_new.h:718
static ETL_CONSTEXPR14 bool test(const_pointer pbuffer, size_t position) ETL_NOEXCEPT
Definition bitset_new.h:894
ETL_CONSTEXPR14 T extract() const
Definition bitset_new.h:2293
static ETL_CONSTEXPR14 void operator_not(pointer pbuffer, size_t) ETL_NOEXCEPT
Definition bitset_new.h:770
bitset< MaxN > & set()
Set all of the bits.
Definition bitset_legacy.h:1205
static ETL_CONSTEXPR14 TString to_string(const_pointer pbuffer, size_t active_bits, typename TString::value_type zero=typename TString::value_type('0'), typename TString::value_type one=typename TString::value_type('1'))
Returns a string representing the bitset.
Definition bitset_new.h:649
ETL_CONSTEXPR14 etl::enable_if< etl::is_same< TPString, constchar32_t * >::value, bitset< Active_Bits, TElement > & >::type set(TPString text) ETL_NOEXCEPT
Set from a char32 string.
Definition bitset_new.h:2206
ETL_CONSTEXPR14 bitset() ETL_NOEXCEPT
Default constructor.
Definition bitset_new.h:2037
bitset< MaxN > & operator>>=(size_t shift)
operator >>=
Definition bitset_legacy.h:1461
static ETL_CONSTEXPR etl::bitset_storage_model storage_model() ETL_NOEXCEPT
Definition bitset_new.h:2428
Bitset forward declaration.
Definition bitset_legacy.h:1128
Definition bitset_legacy.h:85
Definition bitset_new.h:199
Definition bitset_new.h:154
Definition bitset_legacy.h:127
Definition bitset_new.h:126
ETL_CONSTEXPR14 bool operator!=(const etl::bitset< Active_Bits, TElement > &lhs, const etl::bitset< Active_Bits, TElement > &rhs) ETL_NOEXCEPT
Definition bitset_new.h:2797
ETL_CONSTEXPR14 etl::enable_if<!etl::is_same< TLhsElement, TRhsElement >::value, bool >::type operator==(const etl::bitset< Active_Bits, TLhsElement > &lhs, const etl::bitset< Active_Bits, TRhsElement > &rhs) ETL_NOEXCEPT
Definition bitset_new.h:3745
Definition bitset_new.h:92
#define ETL_ASSERT(b, e)
Definition error_handler.h:316
Definition exception.h:47
Definition integral_limits.h:516
enable_if
Definition type_traits_generator.h:1191
is_integral
Definition type_traits_generator.h:1001
is_same
Definition type_traits_generator.h:1041
is_unsigned
Definition type_traits_generator.h:1021
make_unsigned
Definition type_traits_generator.h:1181
bitset_ext
Definition absolute.h:38
etl::byte operator|(etl::byte lhs, etl::byte rhs)
Or.
Definition byte.h:265
etl::byte operator&(etl::byte lhs, etl::byte rhs)
And.
Definition byte.h:273
ETL_CONSTEXPR14 size_t strlen(const T *t)
Alternative strlen for all character types.
Definition char_traits.h:285
void swap(etl::array< T, SIZE > &lhs, etl::array< T, SIZE > &rhs)
Template deduction guides.
Definition array.h:630
etl::byte operator^(etl::byte lhs, etl::byte rhs)
Exclusive Or.
Definition byte.h:281
ETL_CONSTEXPR TContainer::size_type size(const TContainer &container)
Definition iterator.h:1187
pair holds two objects of arbitrary type
Definition utility.h:164
ETL_CONSTEXPR pair()
Default constructor.
Definition utility.h:176
const TIString & to_string(const bool value, TIString &str, const etl::basic_format_spec< TIString > &format, const bool append=false)
For booleans.
Definition to_string_helper.h:501