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>
182 template <
typename TElement>
185 template <
typename TElement>
188 template <
typename TElement>
191 template <
typename TElement>
199 template <
typename TElement,
char Bitset_Layout>
206 template <
typename TElement>
230 *pbuffer = All_Set_Element & top_mask;
257 template <
size_t Position>
278 template <
size_t Position,
bool Value>
301 size_t ) ETL_NOEXCEPT
303 *pbuffer = All_Clear_Element;
327 const char* text) ETL_NOEXCEPT
329 reset_all(pbuffer, 1U);
331 if (text != ETL_NULLPTR)
342 if (text[
i] == ETL_STR(
'1'))
360 const wchar_t* text) ETL_NOEXCEPT
362 reset_all(pbuffer, 1U);
364 if (text != ETL_NULLPTR)
375 if (text[
i] == ETL_STRL(
'1'))
393 const char16_t* text) ETL_NOEXCEPT
395 reset_all(pbuffer, 1U);
397 if (text != ETL_NULLPTR)
408 if (text[
i] == ETL_STRu(
'1'))
426 const char32_t* text) ETL_NOEXCEPT
428 reset_all(pbuffer, 1U);
430 if (text != ETL_NULLPTR)
441 if (text[
i] == ETL_STRU(
'1'))
454 template <
typename T>
458 size_t ) ETL_NOEXCEPT
466 template <
typename T>
485 return static_cast<T>(value);
494 template <
typename T,
size_t Position,
size_t Length>
512 return static_cast<T>(value);
525 return (*pbuffer &
mask) != 0
U;
534 size_t ) ETL_NOEXCEPT
544 bool all(const_pointer pbuffer,
546 element_type top_mask) ETL_NOEXCEPT
548 return (*pbuffer & top_mask) == top_mask;
556 bool all(const_pointer pbuffer,
558 element_type top_mask,
559 element_type mask) ETL_NOEXCEPT
561 return (*pbuffer & top_mask & mask) == mask;
570 size_t ) ETL_NOEXCEPT
572 return *pbuffer == All_Clear_Element;
584 return (*pbuffer &
mask) == All_Clear_Element;
593 size_t ) ETL_NOEXCEPT
595 return *pbuffer != All_Clear_Element;
607 return (*pbuffer &
mask) != All_Clear_Element;
616 size_t ) ETL_NOEXCEPT
618 *pbuffer = ~*pbuffer;
647 template <
typename TString>
652 typename TString::value_type
zero =
typename TString::value_type(
'0'),
653 typename TString::value_type
one =
typename TString::value_type(
'1'))
682 size_t position) ETL_NOEXCEPT
687 size_t bit = position;
692 if ((state && (*pbuffer != All_Clear_Element)) || (!state && (*pbuffer != All_Set_Element)))
698 if (((*pbuffer &
mask) != 0) == state)
721 size_t ) ETL_NOEXCEPT
734 size_t ) ETL_NOEXCEPT
747 size_t ) ETL_NOEXCEPT
760 size_t ) ETL_NOEXCEPT
772 size_t ) ETL_NOEXCEPT
774 *pbuffer = ~*pbuffer;
785 size_t shift) ETL_NOEXCEPT
789 reset_all(pbuffer, 1U);
805 size_t shift) ETL_NOEXCEPT
809 reset_all(pbuffer, 1U);
824 size_t ) ETL_NOEXCEPT
832 template <
typename TElementType>
837 unsigned long long value) ETL_NOEXCEPT
849 size_t ) ETL_NOEXCEPT
861 template <
typename TElement>
883 template <
size_t Position,
size_t Length,
size_t Bits_Per_Element>
896 size_t position) ETL_NOEXCEPT
901 return (pbuffer[index] &
mask) != 0;
910 size_t number_of_elements) ETL_NOEXCEPT
914 while (number_of_elements-- != 0)
927 bool all(const_pointer pbuffer,
928 size_t number_of_elements,
929 element_type top_mask) ETL_NOEXCEPT
932 while (number_of_elements-- != 1U)
934 if (*pbuffer++ != All_Set_Element)
941 if ((*pbuffer & top_mask) != top_mask)
955 size_t number_of_elements) ETL_NOEXCEPT
957 while (number_of_elements-- != 0)
974 size_t number_of_elements) ETL_NOEXCEPT
978 while (number_of_elements-- != 0)
980 if (*pbuffer++ != All_Clear_Element)
996 size_t number_of_elements,
999 while (number_of_elements-- != 1U)
1001 *pbuffer++ = All_Set_Element;
1004 *pbuffer = (All_Set_Element & top_mask);
1014 bool value =
true) ETL_NOEXCEPT
1021 pbuffer[index] |=
bit;
1025 pbuffer[index] &=
~bit;
1032 template <
size_t Position>
1043 pbuffer[index] |=
bit;
1047 pbuffer[index] &=
~bit;
1054 template <
size_t Position,
bool Value>
1064 pbuffer[index] |=
bit;
1068 pbuffer[index] &=
~bit;
1078 size_t number_of_elements,
1080 const char* text) ETL_NOEXCEPT
1082 if (text == ETL_NULLPTR)
1084 etl::fill_n(pbuffer, number_of_elements, All_Clear_Element);
1089 size_t index = etl::min(number_of_elements - 1U, (
string_length / Bits_Per_Element));
1092 while (index != number_of_elements)
1094 pbuffer[index++] = All_Clear_Element;
1102 set_position(pbuffer, --
i, *text++ == ETL_STR(
'1'));
1113 size_t number_of_elements,
1115 const wchar_t* text) ETL_NOEXCEPT
1117 if (text == ETL_NULLPTR)
1119 etl::fill_n(pbuffer, number_of_elements, All_Clear_Element);
1124 size_t index = etl::min(number_of_elements - 1U, (
string_length / Bits_Per_Element));
1127 while (index != number_of_elements)
1129 pbuffer[index++] = All_Clear_Element;
1137 set_position(pbuffer, --
i, *text++ == ETL_STRL(
'1'));
1148 size_t number_of_elements,
1150 const char16_t* text) ETL_NOEXCEPT
1152 if (text == ETL_NULLPTR)
1154 etl::fill_n(pbuffer, number_of_elements, All_Clear_Element);
1159 size_t index = etl::min(number_of_elements - 1U, (
string_length / Bits_Per_Element));
1162 while (index != number_of_elements)
1164 pbuffer[index++] = All_Clear_Element;
1172 set_position(pbuffer, --
i, *text++ == ETL_STRu(
'1'));
1183 size_t number_of_elements,
1185 const char32_t* text) ETL_NOEXCEPT
1187 if (text == ETL_NULLPTR)
1189 etl::fill_n(pbuffer, number_of_elements, All_Clear_Element);
1194 size_t index = etl::min(number_of_elements - 1U, (
string_length / Bits_Per_Element));
1197 while (index != number_of_elements)
1199 pbuffer[index++] = All_Clear_Element;
1207 set_position(pbuffer, --
i, *text++ == ETL_STRU(
'1'));
1218 size_t number_of_elements) ETL_NOEXCEPT
1220 while (number_of_elements-- != 0
U)
1222 *pbuffer++ = All_Clear_Element;
1232 size_t position) ETL_NOEXCEPT
1237 pbuffer[index] &=
~bit;
1243 template <
typename T>
1247 size_t number_of_elements) ETL_NOEXCEPT
1251 const bool OK = (
sizeof(
T) *
CHAR_BIT) >= (number_of_elements * Bits_Per_Element);
1257 for (
size_t i = 0
UL;
i < number_of_elements; ++
i)
1270 template <
typename T>
1276 size_t length) ETL_NOEXCEPT
1288 if (length >= Bits_Per_Element)
1290 value = value << Bits_Per_Element;
1296 while (length >= Bits_Per_Element)
1299 length -= Bits_Per_Element;
1300 if (length >= Bits_Per_Element)
1302 value = value << Bits_Per_Element;
1310 value = value << length;
1322 template <
typename T>
1327 size_t length) ETL_NOEXCEPT
1362 template <
typename T,
size_t Position,
size_t Length>
1381 template <
typename T,
size_t Position,
size_t Length>
1399 template <
typename T>
1415 return static_cast<T>(value);
1421 template <
typename T,
size_t Position,
size_t Length>
1435 return static_cast<T>(value);
1444 size_t number_of_elements) ETL_NOEXCEPT
1446 operator_not(pbuffer, number_of_elements);
1455 size_t position) ETL_NOEXCEPT
1460 pbuffer[index] ^=
bit;
1472 size_t number_of_elements,
1475 size_t position) ETL_NOEXCEPT
1479 size_t bit = position & (Bits_Per_Element - 1);
1484 while (index < number_of_elements)
1489 if ((state && (value != All_Clear_Element)) ||
1490 (!state && (value != All_Set_Element)))
1496 if (((value &
mask) != 0) == state)
1509 position += (Bits_Per_Element -
bit);
1525 template <
typename TString>
1530 typename TString::value_type
zero,
1531 typename TString::value_type
one)
1555 size_t number_of_elements) ETL_NOEXCEPT
1557 while (number_of_elements-- != 0)
1572 size_t number_of_elements) ETL_NOEXCEPT
1574 while (number_of_elements-- != 0)
1589 size_t number_of_elements) ETL_NOEXCEPT
1591 while (number_of_elements-- != 0)
1606 size_t number_of_elements) ETL_NOEXCEPT
1608 while (number_of_elements-- != 0)
1622 size_t number_of_elements) ETL_NOEXCEPT
1624 while (number_of_elements-- != 0)
1626 *pbuffer = ~*pbuffer;
1637 size_t number_of_elements,
1639 size_t shift) ETL_NOEXCEPT
1643 reset_all(pbuffer, number_of_elements);
1701 size_t number_of_elements,
1703 size_t shift) ETL_NOEXCEPT
1707 reset_all(pbuffer, number_of_elements);
1729 while (
src_index <
int(number_of_elements - 1))
1753 while (
dst_index <
int(number_of_elements))
1768 size_t number_of_elements) ETL_NOEXCEPT
1777 template <
typename TElementType>
1782 size_t number_of_elements,
1783 unsigned long long value) ETL_NOEXCEPT
1788 pbuffer[
i++] = value;
1791 while (
i != number_of_elements)
1793 pbuffer[
i++] = All_Clear_Element;
1801 template <
typename TElementType>
1806 size_t number_of_elements,
1807 unsigned long long value) ETL_NOEXCEPT
1814 while ((value != 0) && (
i != number_of_elements))
1816 pbuffer[
i++] = value & All_Set_Element;
1817 value = value >>
Shift;
1821 while (
i != number_of_elements)
1823 pbuffer[
i++] = All_Clear_Element;
1834 size_t number_of_elements)
1840 namespace private_bitset
1843 template <
size_t Active_Bits,
typename TElement>
1848 typedef typename etl::private_bitset::bitset_impl_common<TElement>::element_type
element_type;
1854 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;
1855 static ETL_CONSTANT
size_t Size = Active_Bits;
1856 static ETL_CONSTANT
size_t Allocated_Bits = Number_Of_Elements * Bits_Per_Element;
1869 static ETL_CONSTANT
size_t Top_Mask_Shift = ((Bits_Per_Element - ((Number_Of_Elements * Bits_Per_Element) - Active_Bits)) % Bits_Per_Element);
1873 static ETL_CONSTANT
TElement Top_Mask =
element_type(Top_Mask_Shift == 0 ? All_Set_Element : ~(All_Set_Element << Top_Mask_Shift));
1877 template <
size_t Active_Bits,
typename TElement>
1880 template <
size_t Active_Bits,
typename TElement>
1884 template <
size_t Active_Bits,
typename TElement>
1887 template <
size_t Active_Bits,
typename TElement>
1891 template <
size_t Active_Bits,
typename TElement>
1894 template <
size_t Active_Bits,
typename TElement>
1901 template <
size_t Active_Bits = 0
U,
1930 template <
size_t Active_Bits,
typename TElement>
1965 : p_bitset(
other.p_bitset)
1966 , position(
other.position)
1975 return p_bitset->
test(position);
1983 p_bitset->
set(position,
b);
1992 p_bitset->
set(position,
bool(
r));
2001 p_bitset->
flip(position);
2010 return !p_bitset->
test(position);
2019 : p_bitset(ETL_NULLPTR)
2033 bitset<Active_Bits, TElement>* p_bitset;
2043 implementation::reset_all(buffer, Number_Of_Elements);
2052 implementation::operator_assignment(buffer,
other.buffer, Number_Of_Elements);
2058 template <
typename TValue>
2068 template <
typename TPString>
2072 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2078 template <
typename TPString>
2082 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2088 template <
typename TPString>
2092 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2098 template <
typename TPString>
2102 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2110 implementation::operator_assignment(buffer,
other.buffer, Number_Of_Elements);
2120 implementation::set_all(buffer, Number_Of_Elements, Top_Mask);
2131 ETL_ASSERT_OR_RETURN_VALUE(position < Active_Bits, ETL_ERROR(
bitset_overflow), *
this);
2133 implementation::set_position(buffer, position,
value);
2141 template <
size_t Position>
2144 ETL_STATIC_ASSERT(
Position < Active_Bits,
"Position out of bounds");
2154 template <
size_t Position,
bool Value>
2157 ETL_STATIC_ASSERT(
Position < Active_Bits,
"Position out of bounds");
2167 template <
typename TPString>
2172 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2180 template <
typename TPString>
2185 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2193 template <
typename TPString>
2198 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2206 template <
typename TPString>
2211 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2221 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2231 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2241 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2251 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2259 template <
typename T>
2274 template <
typename T>
2281 ETL_ASSERT_OR_RETURN_VALUE((position + length) <= Active_Bits, ETL_ERROR(
bitset_overflow), 0);
2293 template <
typename T,
size_t Position,
size_t Length>
2300 ETL_STATIC_ASSERT((
Position +
Length) <= Active_Bits,
"Position/Length overflows bitset");
2330 implementation::reset_all(buffer, Number_Of_Elements);
2340 ETL_ASSERT_OR_RETURN_VALUE(position < Active_Bits, ETL_ERROR(
bitset_overflow), *
this);
2342 implementation::reset_position(buffer, position);
2351 ETL_CONSTEXPR14
bool test(
size_t position)
const
2353 ETL_ASSERT_OR_RETURN_VALUE(position < Active_Bits, ETL_ERROR(
bitset_overflow),
false);
2355 return implementation::test(buffer, position);
2362 template <
size_t Position>
2365 ETL_STATIC_ASSERT(
Position < Active_Bits,
"Position out of bounds");
2367 return implementation::test(buffer,
Position);
2373 static ETL_CONSTEXPR
size_t size() ETL_NOEXCEPT
2383 return Number_Of_Elements;
2391 return All_Set_Element;
2399 return All_Clear_Element;
2407 return Bits_Per_Element;
2413 static ETL_CONSTEXPR element_type
top_mask() ETL_NOEXCEPT
2423 return Number_Of_Elements * Bits_Per_Element;
2433 return Storage_Model;
2441 return implementation::count(buffer, Number_Of_Elements);
2447 ETL_CONSTEXPR14
bool all()
const ETL_NOEXCEPT
2449 return implementation::all(buffer, Number_Of_Elements, Top_Mask);
2455 ETL_CONSTEXPR14
bool all(element_type mask)
const ETL_NOEXCEPT
2457 ETL_STATIC_ASSERT(Storage_Model == etl::bitset_storage_model::Single,
"Not supported for 'Multi' bitset storage model");
2459 return implementation::all(buffer, Number_Of_Elements, Top_Mask, mask);
2467 return implementation::none(buffer, Number_Of_Elements);
2473 ETL_CONSTEXPR14
bool none(element_type
mask)
const ETL_NOEXCEPT
2475 ETL_STATIC_ASSERT(Storage_Model == etl::bitset_storage_model::Single,
"Not supported for 'Multi' bitset storage model");
2477 return implementation::none(buffer, Number_Of_Elements,
mask);
2485 return implementation::any(buffer, Number_Of_Elements);
2491 ETL_CONSTEXPR14
bool any(element_type
mask)
const ETL_NOEXCEPT
2493 ETL_STATIC_ASSERT(Storage_Model == etl::bitset_storage_model::Single,
"Not supported for 'Multi' bitset storage model");
2495 return implementation::any(buffer, Number_Of_Elements,
mask);
2503 implementation::flip_all(buffer, Number_Of_Elements);
2513 ETL_ASSERT_OR_RETURN_VALUE(position < Active_Bits, ETL_ERROR(
bitset_overflow), *
this);
2515 implementation::flip_position(buffer, position);
2523 ETL_CONSTEXPR14
bool operator[] (
size_t position)
const ETL_NOEXCEPT
2525 return implementation::test(buffer, position);
2540 template <
typename TString = etl::
string<Active_Bits>>
2542 template <
typename TString>
2545 typename TString::value_type
one =
typename TString::value_type(
'1'))
const
2557 return implementation::find_next(buffer, Number_Of_Elements, Active_Bits, state, 0);
2566 ETL_CONSTEXPR14
size_t find_next(
bool state,
size_t position)
const ETL_NOEXCEPT
2568 return implementation::find_next(buffer, Number_Of_Elements, Active_Bits, state, position);
2578 implementation::operator_and(
temp.buffer,
other.buffer, Number_Of_Elements);
2588 implementation::operator_and(buffer,
other.buffer, Number_Of_Elements);
2600 implementation::operator_or(
temp.buffer,
other.buffer, Number_Of_Elements);
2610 implementation::operator_or(&buffer[0], &
other.buffer[0], Number_Of_Elements);
2622 implementation::operator_xor(
temp.buffer,
other.buffer, Number_Of_Elements);
2632 implementation::operator_xor(buffer,
other.buffer, Number_Of_Elements);
2644 implementation::flip_all(
temp.buffer, Number_Of_Elements);
2656 implementation::operator_shift_left(
temp.buffer, Number_Of_Elements, Active_Bits,
shift);
2666 if (
shift >= Active_Bits)
2668 implementation::reset_all(buffer, Number_Of_Elements);
2672 implementation::operator_shift_left(buffer, Number_Of_Elements, Active_Bits,
shift);
2685 implementation::operator_shift_right(
temp.buffer, Number_Of_Elements, Active_Bits,
shift);
2695 if (
shift >= Active_Bits)
2697 implementation::reset_all(buffer, Number_Of_Elements);
2701 implementation::operator_shift_right(buffer, Number_Of_Elements, Active_Bits,
shift);
2712 return implementation::operator_equality(
lhs.buffer,
rhs.buffer,
lhs.Number_Of_Elements);
2728 implementation::swap(buffer,
other.buffer, Number_Of_Elements);
2737 return span_type(buffer, Number_Of_Elements);
2755 element_type buffer[Number_Of_Elements];
2762 template <
size_t Active_Bits,
typename TElement>
2774 template<
size_t Active_Bits,
typename TElement>
2786 template<
size_t Active_Bits,
typename TElement>
2799template<
size_t Active_Bits,
typename TElement>
2802 return !(lhs == rhs);
2808template <
size_t Active_Bits,
typename TElement>
2820 template <
size_t Active_Bits = 0U,
2821 typename TElement =
unsigned char>
2832 typedef size_t size_type;
2851 template <
size_t Active_Bits,
typename TElement>
2858 typedef size_t size_type;
2882 friend class bitset_ext;
2888 : p_bitset(
other.p_bitset)
2889 , position(
other.position)
2898 return p_bitset->test(position);
2906 p_bitset->set(position,
b);
2915 p_bitset->set(position,
bool(
r));
2924 p_bitset->flip(position);
2933 return !p_bitset->test(position);
2942 : p_bitset(ETL_NULLPTR)
2956 bitset_ext<Active_Bits, TElement>* p_bitset;
2963 ETL_CONSTEXPR14
explicit bitset_ext(element_type* pbuffer_)
2967 implementation::reset_all(pbuffer, Number_Of_Elements);
2973 ETL_CONSTEXPR14
explicit bitset_ext(buffer_type& buffer)
2974 : pbuffer(buffer.data())
2977 implementation::reset_all(pbuffer, Number_Of_Elements);
2983 ETL_CONSTEXPR14 bitset_ext(
const bitset_ext<Active_Bits, TElement>& other, element_type* pbuffer_)
2987 implementation::operator_assignment(pbuffer, other.pbuffer, Number_Of_Elements);
2993 ETL_CONSTEXPR14 bitset_ext(
const bitset_ext<Active_Bits, TElement>& other, buffer_type& buffer) ETL_NOEXCEPT
2994 : pbuffer(buffer.data())
2996 implementation::operator_assignment(pbuffer, other.pbuffer, Number_Of_Elements);
3002 ETL_CONSTEXPR14 bitset_ext(
const bitset_ext<Active_Bits, TElement>& other) ETL_NOEXCEPT ETL_DELETE;
3007 ETL_CONSTEXPR14 bitset_ext(
unsigned long long value, element_type* pbuffer_)
3017 template <
typename TValue>
3018 ETL_CONSTEXPR14 bitset_ext(TValue value, buffer_type& buffer,
typename etl::enable_if<is_integral<TValue>::value>::type* = 0) ETL_NOEXCEPT
3019 : pbuffer(buffer.data())
3027 template <
typename TPString>
3028 ETL_CONSTEXPR14 bitset_ext(TPString text, element_type* pbuffer_,
typename etl::enable_if<is_same<TPString, const char*>::value>::type* = 0)
3032 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3038 template <
typename TPString>
3039 ETL_CONSTEXPR14 bitset_ext(TPString text, buffer_type& buffer,
typename etl::enable_if<is_same<TPString, const char*>::value>::type* = 0) ETL_NOEXCEPT
3040 : pbuffer(buffer.data())
3042 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3048 template <
typename TPString>
3049 ETL_CONSTEXPR14 bitset_ext(TPString text, element_type* pbuffer_,
typename etl::enable_if<is_same<TPString, const wchar_t*>::value>::type* = 0)
3053 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3059 template <
typename TPString>
3060 ETL_CONSTEXPR14 bitset_ext(TPString text, buffer_type& buffer,
typename etl::enable_if<is_same<TPString, const wchar_t*>::value>::type* = 0) ETL_NOEXCEPT
3061 : pbuffer(buffer.data())
3063 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3069 template <
typename TPString>
3070 ETL_CONSTEXPR14 bitset_ext(TPString text, element_type* pbuffer_,
typename etl::enable_if<is_same<TPString, const char16_t*>::value>::type* = 0)
3074 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3080 template <
typename TPString>
3081 ETL_CONSTEXPR14 bitset_ext(TPString text, buffer_type& buffer,
typename etl::enable_if<is_same<TPString, const char16_t*>::value>::type* = 0) ETL_NOEXCEPT
3082 : pbuffer(buffer.data())
3084 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3090 template <
typename TPString>
3091 ETL_CONSTEXPR14 bitset_ext(TPString text, element_type* pbuffer_,
typename etl::enable_if<is_same<TPString, const char32_t*>::value>::type* = 0)
3095 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3101 template <
typename TPString>
3102 ETL_CONSTEXPR14 bitset_ext(TPString text, buffer_type& buffer,
typename etl::enable_if<is_same<TPString, const char32_t*>::value>::type* = 0) ETL_NOEXCEPT
3103 : pbuffer(buffer.data())
3105 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3111 ETL_CONSTEXPR14 bitset_ext& operator =(
const bitset_ext<Active_Bits, TElement>& other) ETL_NOEXCEPT
3113 implementation::operator_assignment(pbuffer, other.pbuffer, Number_Of_Elements);
3121 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& set() ETL_NOEXCEPT
3123 implementation::set_all(pbuffer, Number_Of_Elements, Top_Mask);
3132 bitset_ext<Active_Bits, TElement>& set(
size_t position,
bool value =
true)
3134 ETL_ASSERT_OR_RETURN_VALUE(position < Active_Bits, ETL_ERROR(bitset_overflow), *
this);
3136 implementation::set_position(pbuffer, position, value);
3144 template <
size_t Position>
3145 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& set(
bool value =
true)
3147 ETL_STATIC_ASSERT(Position < Active_Bits,
"Position out of bounds");
3157 template <
size_t Position,
bool Value>
3158 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& set()
3160 ETL_STATIC_ASSERT(Position < Active_Bits,
"Position out of bounds");
3170 template <
typename TPString>
3173 set(TPString text) ETL_NOEXCEPT
3175 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3183 template <
typename TPString>
3186 set(TPString text) ETL_NOEXCEPT
3188 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3196 template <
typename TPString>
3199 set(TPString text) ETL_NOEXCEPT
3201 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3209 template <
typename TPString>
3212 set(TPString text) ETL_NOEXCEPT
3214 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3222 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& from_string(
const char* text) ETL_NOEXCEPT
3224 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3232 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& from_string(
const wchar_t* text) ETL_NOEXCEPT
3234 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3242 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& from_string(
const char16_t* text) ETL_NOEXCEPT
3244 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3252 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& from_string(
const char32_t* text) ETL_NOEXCEPT
3254 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3262 template <
typename T>
3264 T value() const ETL_NOEXCEPT
3276 template <
typename T>
3283 ETL_ASSERT_OR_RETURN_VALUE((position + length) <= Active_Bits, ETL_ERROR(bitset_overflow), 0);
3293 template <typename T, size_t Position, size_t Length = etl::integral_limits<T>::bits>
3295 template <
typename T,
size_t Position,
size_t Length>
3302 ETL_STATIC_ASSERT((Position + Length) <= Active_Bits,
"Position/Length overflows bitset");
3310 unsigned long to_ulong()
const
3320 unsigned long long to_ullong()
const
3330 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& reset() ETL_NOEXCEPT
3332 implementation::reset_all(pbuffer, Number_Of_Elements);
3340 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& reset(
size_t position)
3342 ETL_ASSERT_OR_RETURN_VALUE(position < Active_Bits, ETL_ERROR(bitset_overflow), *
this);
3344 implementation::reset_position(pbuffer, position);
3353 ETL_CONSTEXPR14
bool test(
size_t position)
const
3355 ETL_ASSERT_OR_RETURN_VALUE(position < Active_Bits, ETL_ERROR(bitset_overflow),
false);
3357 return implementation::test(pbuffer, position);
3364 template <
size_t Position>
3365 ETL_CONSTEXPR14
bool test()
const
3367 ETL_STATIC_ASSERT(Position < Active_Bits,
"Position out of bounds");
3369 return implementation::test(pbuffer, Position);
3375 static ETL_CONSTEXPR
size_t size() ETL_NOEXCEPT
3383 static ETL_CONSTEXPR
size_t number_of_elements() ETL_NOEXCEPT
3385 return Number_Of_Elements;
3391 static ETL_CONSTEXPR element_type all_set_element() ETL_NOEXCEPT
3393 return All_Set_Element;
3399 static ETL_CONSTEXPR element_type all_clear_element() ETL_NOEXCEPT
3401 return All_Clear_Element;
3407 static ETL_CONSTEXPR element_type top_mask() ETL_NOEXCEPT
3415 static ETL_CONSTEXPR
size_t bits_per_element() ETL_NOEXCEPT
3417 return Bits_Per_Element;
3423 static ETL_CONSTEXPR
size_t allocated_bits() ETL_NOEXCEPT
3425 return Number_Of_Elements * Bits_Per_Element;
3435 return Storage_Model;
3441 ETL_CONSTEXPR14
size_t count() const ETL_NOEXCEPT
3443 return implementation::count(pbuffer, Number_Of_Elements);
3449 ETL_CONSTEXPR14
bool all() const ETL_NOEXCEPT
3451 return implementation::all(pbuffer, Number_Of_Elements, Top_Mask);
3457 ETL_CONSTEXPR14
bool all(element_type mask)
const ETL_NOEXCEPT
3459 ETL_STATIC_ASSERT(Storage_Model == etl::bitset_storage_model::Single,
"Not supported for 'Multi' bitset storage model");
3461 return implementation::all(pbuffer, Number_Of_Elements, Top_Mask, mask);
3467 ETL_CONSTEXPR14
bool none() const ETL_NOEXCEPT
3469 return implementation::none(pbuffer, Number_Of_Elements);
3475 ETL_CONSTEXPR14
bool none(element_type mask)
const ETL_NOEXCEPT
3477 ETL_STATIC_ASSERT(Storage_Model == etl::bitset_storage_model::Single,
"Not supported for 'Multi' bitset storage model");
3479 return implementation::none(pbuffer, Number_Of_Elements, mask);
3485 ETL_CONSTEXPR14
bool any() const ETL_NOEXCEPT
3487 return implementation::any(pbuffer, Number_Of_Elements);
3493 ETL_CONSTEXPR14
bool any(element_type mask)
const ETL_NOEXCEPT
3495 ETL_STATIC_ASSERT(Storage_Model == etl::bitset_storage_model::Single,
"Not supported for 'Multi' bitset storage model");
3497 return implementation::any(pbuffer, Number_Of_Elements, mask);
3503 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& flip() ETL_NOEXCEPT
3505 implementation::flip_all(pbuffer, Number_Of_Elements);
3513 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& flip(
size_t position)
3515 ETL_ASSERT_OR_RETURN_VALUE(position < Active_Bits, ETL_ERROR(bitset_overflow), *
this);
3517 implementation::flip_position(pbuffer, position);
3525 ETL_CONSTEXPR14
bool operator[] (
size_t position)
const ETL_NOEXCEPT
3527 return implementation::test(pbuffer, position);
3533 ETL_CONSTEXPR14 bit_reference operator [] (
size_t position) ETL_NOEXCEPT
3535 return bit_reference(*
this, position);
3542 template <
typename TString = etl::
string<Active_Bits>>
3544 template <
typename TString>
3546 ETL_CONSTEXPR14 TString
to_string(
typename TString::value_type zero =
typename TString::value_type(
'0'),
3547 typename TString::value_type one =
typename TString::value_type(
'1'))
const
3557 ETL_CONSTEXPR14
size_t find_first(
bool state)
const ETL_NOEXCEPT
3559 return implementation::find_next(pbuffer, Number_Of_Elements, Active_Bits, state, 0);
3568 ETL_CONSTEXPR14
size_t find_next(
bool state,
size_t position)
const ETL_NOEXCEPT
3570 return implementation::find_next(pbuffer, Number_Of_Elements, Active_Bits, state, position);
3576 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& operator &=(
const bitset_ext<Active_Bits, TElement>& other) ETL_NOEXCEPT
3578 implementation::operator_and(&pbuffer[0], &other.pbuffer[0], Number_Of_Elements);
3586 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& operator |=(
const bitset_ext<Active_Bits, TElement>& other) ETL_NOEXCEPT
3588 implementation::operator_or(&pbuffer[0], &other.pbuffer[0], Number_Of_Elements);
3596 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& operator ^=(
const bitset_ext<Active_Bits, TElement>& other) ETL_NOEXCEPT
3598 implementation::operator_xor(&pbuffer[0], &other.pbuffer[0], Number_Of_Elements);
3606 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& operator <<=(
size_t shift) ETL_NOEXCEPT
3608 implementation::operator_shift_left(pbuffer, Number_Of_Elements, Active_Bits, shift);
3616 ETL_CONSTEXPR14 bitset_ext<Active_Bits, TElement>& operator >>=(
size_t shift) ETL_NOEXCEPT
3618 implementation::operator_shift_right(pbuffer, Number_Of_Elements, Active_Bits, shift);
3626 friend ETL_CONSTEXPR14
bool operator ==(
const bitset_ext<Active_Bits, TElement>& lhs,
const bitset_ext<Active_Bits, TElement>& rhs) ETL_NOEXCEPT
3628 return implementation::operator_equality(lhs.pbuffer, rhs.pbuffer, lhs.Number_Of_Elements);
3634 friend ETL_CONSTEXPR14
bool operator !=(
const bitset_ext<Active_Bits, TElement>& lhs,
const bitset_ext<Active_Bits, TElement>& rhs) ETL_NOEXCEPT
3636 return !(lhs == rhs);
3644 implementation::swap(pbuffer, other.pbuffer, Number_Of_Elements);
3651 ETL_CONSTEXPR14 span_type span() ETL_NOEXCEPT
3653 return span_type(pbuffer, Number_Of_Elements);
3660 ETL_CONSTEXPR14 const_span_type span() const ETL_NOEXCEPT
3662 return const_span_type(pbuffer, Number_Of_Elements);
3668 typedef etl::bitset_impl<element_type, (Number_Of_Elements == 1U) ? etl::bitset_storage_model::Single :
etl::bitset_storage_model::Multi> implementation;
3671 element_type* pbuffer;
3679template<
size_t Active_Bits,
typename TElement>
3682 return !(lhs == rhs);
3688template <
size_t Active_Bits,
typename TElement>
3696 namespace private_bitset
3702 template <
typename TLhsSpan,
typename TRhsSpan>
3703 bool compare_bitset_spans(
const TLhsSpan& lhs_span,
const TRhsSpan& rhs_span)
3705 typedef typename TLhsSpan::value_type lhs_element_t;
3706 typedef typename TRhsSpan::value_type rhs_element_t;
3708 const int steps =
static_cast<int>(
sizeof(lhs_element_t) /
sizeof(rhs_element_t));
3710 typename TLhsSpan::iterator lhs_itr = lhs_span.begin();
3711 typename TRhsSpan::iterator rhs_itr = rhs_span.begin();
3713 while (lhs_itr != lhs_span.end())
3715 const lhs_element_t& lhs_value = *lhs_itr;
3718 lhs_element_t rhs_value = 0;
3723 for (
int i = 0; i < steps; ++i)
3725 rhs_value |= (
static_cast<lhs_element_t
>(*rhs_itr) << shift);
3727 shift += shift_step;
3730 if (lhs_value != rhs_value)
3749template<
size_t Active_Bits,
typename TLhsElement,
typename TRhsElement>
3759 if ETL_IF_CONSTEXPR(
sizeof(TLhsElement) >
sizeof(TRhsElement))
3761 return etl::private_bitset::compare_bitset_spans(lhs_span, rhs_span);
3765 return etl::private_bitset::compare_bitset_spans(rhs_span, lhs_span);
3775template<
size_t Active_Bits,
typename TLhsElement,
typename TRhsElement>
3780 return !(lhs == rhs);
3789template<
size_t Active_Bits,
typename TLhsElement,
typename TRhsElement>
3799 if ETL_IF_CONSTEXPR(
sizeof(TLhsElement) >
sizeof(TRhsElement))
3801 return etl::private_bitset::compare_bitset_spans(lhs_span, rhs_span);
3805 return etl::private_bitset::compare_bitset_spans(rhs_span, lhs_span);
3815template<
size_t Active_Bits,
typename TLhsElement,
typename TRhsElement>
3820 return !(lhs == rhs);
3828template<
size_t Active_Bits,
typename TElement>
3840 return implementation::operator_equality(lhs_span.begin(), rhs_span.begin(), Number_Of_Elements);
3848template<
size_t Active_Bits,
typename TElement>
3852 return !(lhs == rhs);
3860template<
size_t Active_Bits,
typename TElement>
3872 return implementation::operator_equality(lhs_span.begin(), rhs_span.begin(), Number_Of_Elements);
3880template<
size_t Active_Bits,
typename TElement>
3884 return !(lhs == rhs);
3892template<
size_t Active_Bits,
typename TLhsElement,
typename TRhsElement>
3902 if ETL_IF_CONSTEXPR(
sizeof(TLhsElement) >
sizeof(TRhsElement))
3904 return etl::private_bitset::compare_bitset_spans(lhs_span, rhs_span);
3908 return etl::private_bitset::compare_bitset_spans(rhs_span, lhs_span);
3917template<
size_t Active_Bits,
typename TLhsElement,
typename TRhsElement>
3922 return !(lhs == rhs);
3930template<
size_t Active_Bits,
typename TLhsElement,
typename TRhsElement>
3940 if ETL_IF_CONSTEXPR(
sizeof(TLhsElement) >
sizeof(TRhsElement))
3942 return etl::private_bitset::compare_bitset_spans(lhs_span, rhs_span);
3946 return etl::private_bitset::compare_bitset_spans(rhs_span, lhs_span);
3955template<
size_t Active_Bits,
typename TLhsElement,
typename TRhsElement>
3960 return !(lhs == rhs);
The reference type returned.
Definition bitset_new.h:1956
ETL_CONSTEXPR14 bit_reference(const bit_reference &other) ETL_NOEXCEPT
Copy constructor.
Definition bitset_new.h:1964
ETL_CONSTEXPR14 bit_reference & operator=(bool b) ETL_NOEXCEPT
Assignment operator.
Definition bitset_new.h:1981
ETL_CONSTEXPR14 bit_reference & flip() ETL_NOEXCEPT
Flip the bit.
Definition bitset_new.h:1999
ETL_CONSTEXPR14 bool operator~() const ETL_NOEXCEPT
Return the logical inverse of the bit.
Definition bitset_new.h:2008
The reference type returned.
Definition bitset_new.h:2879
ETL_CONSTEXPR14 bit_reference & operator=(bool b) ETL_NOEXCEPT
Assignment operator.
Definition bitset_new.h:2904
ETL_CONSTEXPR14 bit_reference & flip() ETL_NOEXCEPT
Flip the bit.
Definition bitset_new.h:2922
ETL_CONSTEXPR14 bool operator~() const ETL_NOEXCEPT
Return the logical inverse of the bit.
Definition bitset_new.h:2931
ETL_CONSTEXPR14 bit_reference(const bit_reference &other) ETL_NOEXCEPT
Copy constructor.
Definition bitset_new.h:2887
Definition bitset_new.h:1845
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:968
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:1766
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:1273
ETL_CONSTEXPR14 bool none(element_type mask) const ETL_NOEXCEPT
Are none of the mask bits set?
Definition bitset_new.h:2473
static ETL_CONSTEXPR14 T extract(const_pointer pbuffer)
Extract an integral value from an arbitrary position and length.
Definition bitset_new.h:1424
bitset< MaxN > & operator&=(const bitset< MaxN > &other)
operator &=
Definition bitset_legacy.h:1391
ETL_CONSTEXPR14 size_t find_next(bool state, size_t position) const ETL_NOEXCEPT
Definition bitset_new.h:2566
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:1471
ETL_CONSTEXPR14 T extract(size_t position, size_t length=etl::integral_limits< T >::bits) const
Definition bitset_new.h:2276
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:995
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > & set(size_t position, bool value=true)
Set the bit at the position.
Definition bitset_new.h:2129
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:1366
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:1325
ETL_CONSTEXPR14 bitset(const bitset< Active_Bits, TElement > &other) ETL_NOEXCEPT
Copy constructor.
Definition bitset_new.h:2049
static ETL_CONSTEXPR14 void swap(pointer lhs_pbuffer, pointer rhs_pbuffer, size_t) ETL_NOEXCEPT
swap
Definition bitset_new.h:847
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:2196
friend bool operator==(const bitset< MaxN > &lhs, const bitset< MaxN > &rhs)
operator ==
Definition bitset_legacy.h:1472
static ETL_CONSTEXPR14 void reset_position(pointer pbuffer, size_t position)
Reset the bit at the position.
Definition bitset_new.h:312
static ETL_CONSTEXPR14 void flip_all(pointer pbuffer, size_t) ETL_NOEXCEPT
Flip all of the bits.
Definition bitset_new.h:615
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:1385
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:603
static ETL_CONSTEXPR element_type all_set_element() ETL_NOEXCEPT
The value of a set element.
Definition bitset_new.h:2389
static ETL_CONSTEXPR14 void set_position(pointer pbuffer, size_t position, bool value=true)
Set the bit at the position.
Definition bitset_new.h:238
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > & from_string(const char32_t *text) ETL_NOEXCEPT
Set from a u32 string.
Definition bitset_new.h:2249
bitset< MaxN > & flip()
Flip all of the bits.
Definition bitset_legacy.h:1336
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:1077
static ETL_CONSTEXPR14 T extract(const_pointer pbuffer)
Extract an integral value from an arbitrary position and length.
Definition bitset_new.h:498
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > & from_string(const char16_t *text) ETL_NOEXCEPT
Set from a u16 string.
Definition bitset_new.h:2239
static ETL_CONSTEXPR14 void flip_all(pointer pbuffer, size_t number_of_elements) ETL_NOEXCEPT
Flip all of the bits.
Definition bitset_new.h:1443
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > & set() ETL_NOEXCEPT
Set all of the bits.
Definition bitset_new.h:2118
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:678
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:835
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:1528
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > & flip() ETL_NOEXCEPT
Flip all of the bits.
Definition bitset_new.h:2501
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > & from_string(const char *text) ETL_NOEXCEPT
Set from a string.
Definition bitset_new.h:2219
ETL_CONSTEXPR14 const_span_type span() const ETL_NOEXCEPT
Definition bitset_new.h:2744
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:1112
ETL_CONSTEXPR14 bool none() const ETL_NOEXCEPT
Are none of the bits set?
Definition bitset_new.h:2465
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:2089
static ETL_CONSTEXPR14 void flip_position(pointer pbuffer, size_t position)
Flip the bit at the position.
Definition bitset_new.h:637
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:1147
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > operator&(const bitset< Active_Bits, TElement > &other) const ETL_NOEXCEPT
operator &
Definition bitset_new.h:2574
static ETL_CONSTEXPR14 void set_position(pointer pbuffer, bool value=true)
Set the bit at the position.
Definition bitset_new.h:1035
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:1553
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:580
ETL_CONSTEXPR14 size_t find_first(bool state) const ETL_NOEXCEPT
Definition bitset_new.h:2555
static ETL_CONSTEXPR14 void set_position(pointer pbuffer)
Set the bit at the position.
Definition bitset_new.h:1057
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:2059
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > & from_string(const wchar_t *text) ETL_NOEXCEPT
Set from a wide string.
Definition bitset_new.h:2229
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:1570
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > & flip(size_t position)
Flip the bit at the position.
Definition bitset_new.h:2511
etl::enable_if< etl::is_integral< T >::value, T >::type value() const
Put to a value.
Definition bitset_legacy.h:1307
static ETL_CONSTEXPR size_t number_of_elements() ETL_NOEXCEPT
The number of storage elements in the bitset.
Definition bitset_new.h:2381
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:909
static ETL_CONSTEXPR14 void operator_or(pointer lhs_pbuffer, const_pointer rhs_pbuffer, size_t) ETL_NOEXCEPT
Definition bitset_new.h:745
ETL_CONSTEXPR14 void swap(etl::bitset< Active_Bits, TElement > &other) ETL_NOEXCEPT
swap
Definition bitset_new.h:2726
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:1402
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:2544
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:357
static ETL_CONSTEXPR size_t allocated_bits() ETL_NOEXCEPT
The total number of bits of storage, including unused.
Definition bitset_new.h:2421
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:1636
static ETL_CONSTEXPR element_type top_mask() ETL_NOEXCEPT
The mask for the msb element.
Definition bitset_new.h:2413
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:1587
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:802
ETL_CONSTEXPR14 bool test(size_t position) const
Definition bitset_new.h:2351
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:2262
static ETL_CONSTEXPR14 bool any(const_pointer pbuffer, size_t) ETL_NOEXCEPT
Are any of the bits set?
Definition bitset_new.h:592
ETL_CONSTEXPR14 bool any(element_type mask) const ETL_NOEXCEPT
Are any of the mask bits set?
Definition bitset_new.h:2491
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:2099
static ETL_CONSTEXPR element_type all_clear_element() ETL_NOEXCEPT
The value of a clear element.
Definition bitset_new.h:2397
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > & reset() ETL_NOEXCEPT
Reset all of the bits.
Definition bitset_new.h:2328
static ETL_CONSTEXPR14 void reset_all(pointer pbuffer, size_t number_of_elements) ETL_NOEXCEPT
Reset all of the bits.
Definition bitset_new.h:1217
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:324
bitset< MaxN > & operator<<=(size_t shift)
operator <<=
Definition bitset_legacy.h:1442
bitset< MaxN > operator<<(size_t shift) const
operator <<
Definition bitset_legacy.h:1430
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:782
static ETL_CONSTEXPR14 void operator_xor(pointer lhs_pbuffer, const_pointer rhs_pbuffer, size_t) ETL_NOEXCEPT
Definition bitset_new.h:758
static ETL_CONSTEXPR14 T value(const_pointer pbuffer, size_t number_of_elements) ETL_NOEXCEPT
Get as a value.
Definition bitset_new.h:1246
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:626
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:954
static ETL_CONSTEXPR14 void flip_position(pointer pbuffer, size_t position) ETL_NOEXCEPT
Flip the bit at the position.
Definition bitset_new.h:1454
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > operator|(const bitset< Active_Bits, TElement > &other) const ETL_NOEXCEPT
operator |
Definition bitset_new.h:2596
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:1012
static ETL_CONSTEXPR14 void swap(pointer pbuffer1, pointer pbuffer2, size_t number_of_elements)
Swap bitset buffers.
Definition bitset_new.h:1832
static ETL_CONSTEXPR14 void operator_not(pointer pbuffer, size_t number_of_elements) ETL_NOEXCEPT
operator not
Definition bitset_new.h:1621
bitset< MaxN > & operator|=(const bitset< MaxN > &other)
operator |=
Definition bitset_legacy.h:1400
static ETL_CONSTEXPR size_t bits_per_element() ETL_NOEXCEPT
The number of bits in an element.
Definition bitset_new.h:2405
ETL_CONSTEXPR14 size_t count() const ETL_NOEXCEPT
Count the number of bits set.
Definition bitset_new.h:2439
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:1781
bitset< MaxN > operator~() const
operator ~
Definition bitset_legacy.h:1418
static ETL_CONSTEXPR14 T value(const_pointer pbuffer, size_t) ETL_NOEXCEPT
Get as an integral value.
Definition bitset_new.h:457
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > & set(bool value=true)
Set the bit at the position.
Definition bitset_new.h:2142
friend ETL_CONSTEXPR14 bool operator!=(const bitset< Active_Bits, TElement > &lhs, const bitset< Active_Bits, TElement > &rhs) ETL_NOEXCEPT
operator !=
Definition bitset_new.h:2718
ETL_CONSTEXPR14 bool operator[](size_t position) const ETL_NOEXCEPT
Read [] operator.
Definition bitset_new.h:2523
static ETL_CONSTEXPR14 void reset_all(pointer pbuffer, size_t) ETL_NOEXCEPT
Reset all of the bits.
Definition bitset_new.h:300
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:2079
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:2170
bitset< MaxN > operator>>(size_t shift) const
operator >>
Definition bitset_legacy.h:1451
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:973
static ETL_CONSTEXPR14 bool test(const_pointer pbuffer, size_t position)
Definition bitset_new.h:521
static ETL_CONSTEXPR14 void reset_position(pointer pbuffer, size_t position) ETL_NOEXCEPT
Reset the bit at the position.
Definition bitset_new.h:1231
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > operator^(const bitset< Active_Bits, TElement > &other) const ETL_NOEXCEPT
operator ^
Definition bitset_new.h:2618
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:226
static ETL_CONSTEXPR14 bool none(const_pointer pbuffer, size_t) ETL_NOEXCEPT
Are none of the bits set?
Definition bitset_new.h:569
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:1182
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > & reset(size_t position)
Reset the bit at the position.
Definition bitset_new.h:2338
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:2183
static ETL_CONSTEXPR size_t size() ETL_NOEXCEPT
The number of bits in the bitset.
Definition bitset_new.h:2373
bitset< MaxN > & operator=(const bitset< MaxN > &other)
operator =
Definition bitset_legacy.h:1378
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:2069
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:423
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:1700
bitset< MaxN > & operator^=(const bitset< MaxN > &other)
operator ^=
Definition bitset_legacy.h:1409
static ETL_CONSTEXPR14 void operator_and(pointer lhs_pbuffer, const_pointer rhs_pbuffer, size_t) ETL_NOEXCEPT
Definition bitset_new.h:732
static ETL_CONSTEXPR14 void set_position(pointer pbuffer)
Set the bit at the position.
Definition bitset_new.h:281
ETL_CONSTEXPR14 bitset< Active_Bits, TElement > & set()
Set the bit at the position.
Definition bitset_new.h:2155
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:469
unsigned long long to_ullong() const
Get as an unsigned long long.
Definition bitset_new.h:2318
ETL_CONSTEXPR14 bool any() const ETL_NOEXCEPT
Are any of the bits set?
Definition bitset_new.h:2483
static ETL_CONSTEXPR14 bool operator_equality(const_pointer lhs_pbuffer, const_pointer rhs_pbuffer, size_t) ETL_NOEXCEPT
operator_equality
Definition bitset_new.h:822
ETL_CONSTEXPR14 bool test() const
Definition bitset_new.h:2363
ETL_CONSTEXPR14 span_type span() ETL_NOEXCEPT
Definition bitset_new.h:2735
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:390
static ETL_CONSTEXPR14 void set_position(pointer pbuffer, bool value=true)
Set the bit at the position.
Definition bitset_new.h:260
unsigned long to_ulong() const
Get as an unsigned long.
Definition bitset_new.h:2308
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:1604
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:1805
static ETL_CONSTEXPR14 size_t count(const_pointer pbuffer, size_t) ETL_NOEXCEPT
Count the number of bits set.
Definition bitset_new.h:533
static ETL_CONSTEXPR14 void operator_assignment(pointer lhs_pbuffer, const_pointer rhs_pbuffer, size_t) ETL_NOEXCEPT
Definition bitset_new.h:719
static ETL_CONSTEXPR14 bool test(const_pointer pbuffer, size_t position) ETL_NOEXCEPT
Definition bitset_new.h:895
ETL_CONSTEXPR14 T extract() const
Definition bitset_new.h:2296
static ETL_CONSTEXPR14 void operator_not(pointer pbuffer, size_t) ETL_NOEXCEPT
Definition bitset_new.h:771
bitset< MaxN > & set()
Set all of the bits.
Definition bitset_legacy.h:1207
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:650
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:2209
ETL_CONSTEXPR14 bitset() ETL_NOEXCEPT
Default constructor.
Definition bitset_new.h:2040
bitset< MaxN > & operator>>=(size_t shift)
operator >>=
Definition bitset_legacy.h:1463
static ETL_CONSTEXPR etl::bitset_storage_model storage_model() ETL_NOEXCEPT
Definition bitset_new.h:2431
Bitset forward declaration.
Definition bitset_legacy.h:1130
Definition bitset_legacy.h:85
Definition bitset_new.h:200
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:2800
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:3752
Definition bitset_new.h:92
#define ETL_ASSERT(b, e)
Definition error_handler.h:356
Definition exception.h:47
Definition integral_limits.h:516
enable_if
Definition type_traits_generator.h:1186
is_integral
Definition type_traits_generator.h:996
is_same
Definition type_traits_generator.h:1036
is_unsigned
Definition type_traits_generator.h:1016
make_unsigned
Definition type_traits_generator.h:1176
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