30#ifndef ETL_BITSET_NEW_INCLUDED
31#define ETL_BITSET_NEW_INCLUDED
44#include "../static_assert.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")
115 bitset_exception(string_type reason_, string_type file_name_, numeric_type line_number_)
116 :
exception(reason_, file_name_, line_number_)
125 class bitset_string_too_small :
public bitset_exception
129 bitset_string_too_small(string_type file_name_, numeric_type line_number_)
130 : bitset_exception(ETL_ERROR_TEXT(
"bitset:type_too_small", ETL_BITSET_FILE_ID
"A"), file_name_, line_number_)
144 :
bitset_exception(ETL_ERROR_TEXT(
"bitset:overflow", ETL_BITSET_FILE_ID
"B"), file_name_, line_number_)
153 class bitset_invalid_buffer :
public bitset_exception
157 bitset_invalid_buffer(string_type file_name_, numeric_type line_number_)
158 : bitset_exception(ETL_ERROR_TEXT(
"bitset:invalid buffer", ETL_BITSET_FILE_ID
"C"), file_name_, line_number_)
164 namespace private_bitset
166 template <
typename TElement>
171 typedef TElement element_type;
172 typedef TElement* pointer;
173 typedef const TElement* const_pointer;
174 typedef size_t size_type;
179 static ETL_CONSTANT TElement All_Clear_Element = element_type(0);
182 template <
typename TElement>
183 ETL_CONSTANT
size_t bitset_impl_common<TElement>::npos;
185 template <
typename TElement>
186 ETL_CONSTANT
size_t bitset_impl_common<TElement>::Bits_Per_Element;
188 template <
typename TElement>
189 ETL_CONSTANT TElement bitset_impl_common<TElement>::All_Set_Element;
191 template <
typename TElement>
192 ETL_CONSTANT TElement bitset_impl_common<TElement>::All_Clear_Element;
199 template <
typename TElement,
char Bitset_Layout>
206 template <
typename TElement>
211 using typename etl::private_bitset::bitset_impl_common<TElement>::element_type;
212 using typename etl::private_bitset::bitset_impl_common<TElement>::pointer;
213 using typename etl::private_bitset::bitset_impl_common<TElement>::const_pointer;
228 element_type top_mask) ETL_NOEXCEPT
230 *pbuffer = All_Set_Element & top_mask;
242 const element_type mask = element_type(element_type(1) << position);
257 template <
size_t Position>
263 const element_type mask = element_type(element_type(1) << Position);
278 template <
size_t Position,
bool Value>
283 const element_type mask = element_type(element_type(1) << Position);
301 size_t ) ETL_NOEXCEPT
303 *pbuffer = All_Clear_Element;
315 const element_type mask = element_type(element_type(1) << position);
327 const char* text) ETL_NOEXCEPT
331 if (text != ETL_NULLPTR)
336 string_length = etl::min(active_bits, string_length);
338 element_type mask = element_type(element_type(1) << (string_length - 1U));
340 for (
size_t i = 0U; i < string_length; ++i)
342 if (text[i] == ETL_STR(
'1'))
360 const wchar_t* text) ETL_NOEXCEPT
364 if (text != ETL_NULLPTR)
369 string_length = etl::min(active_bits, string_length);
371 element_type mask = element_type(element_type(1) << (string_length - 1U));
373 for (
size_t i = 0U; i < string_length; ++i)
375 if (text[i] == ETL_STRL(
'1'))
393 const char16_t* text) ETL_NOEXCEPT
397 if (text != ETL_NULLPTR)
402 string_length = etl::min(active_bits, string_length);
404 element_type mask = element_type(element_type(1) << (string_length - 1U));
406 for (
size_t i = 0U; i < string_length; ++i)
408 if (text[i] == ETL_STRu(
'1'))
426 const char32_t* text) ETL_NOEXCEPT
430 if (text != ETL_NULLPTR)
435 string_length = etl::min(active_bits, string_length);
437 element_type mask = element_type(element_type(1) << (string_length - 1U));
439 for (
size_t i = 0U; i < string_length; ++i)
441 if (text[i] == ETL_STRU(
'1'))
454 template <
typename T>
458 size_t ) ETL_NOEXCEPT
466 template <
typename T>
475 const unsigned_t Mask = etl::make_lsb_mask<unsigned_t>(length);
476 const unsigned_t Shift = position % Bits_Per_Element;
478 unsigned_t
value =
static_cast<unsigned_t
>(*pbuffer >> Shift) & Mask;
485 return static_cast<T
>(
value);
492 template <typename T, size_t Position, size_t Length = etl::integral_limits<T>::bits>
494 template <
typename T,
size_t Position,
size_t Length>
502 const unsigned_t Mask = etl::make_lsb_mask<unsigned_t>(Length);
503 const unsigned_t Shift = Position % Bits_Per_Element;
505 unsigned_t
value =
static_cast<unsigned_t
>(*pbuffer >> Shift) & Mask;
512 return static_cast<T
>(
value);
521 bool test(const_pointer pbuffer,
524 const element_type mask = element_type(element_type(1) << position);
525 return (*pbuffer & mask) != 0U;
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;
569 bool none(const_pointer pbuffer,
570 size_t ) ETL_NOEXCEPT
572 return *pbuffer == All_Clear_Element;
580 bool none(const_pointer pbuffer,
582 element_type mask) ETL_NOEXCEPT
584 return (*pbuffer & mask) == All_Clear_Element;
592 bool any(const_pointer pbuffer,
593 size_t ) ETL_NOEXCEPT
595 return *pbuffer != All_Clear_Element;
603 bool any(const_pointer pbuffer,
605 element_type mask) ETL_NOEXCEPT
607 return (*pbuffer & mask) != All_Clear_Element;
616 size_t ) ETL_NOEXCEPT
618 *pbuffer = ~*pbuffer;
640 const element_type mask = element_type(element_type(1) << position);
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'))
657 result.resize(active_bits,
'\0');
662 for (
size_t i = active_bits; i > 0; --i)
664 result[active_bits - i] =
test(pbuffer, i - 1) ? one : zero;
682 size_t position) ETL_NOEXCEPT
684 if (position < active_bits)
687 size_t bit = position;
689 element_type mask = 1U << position;
692 if ((state && (*pbuffer != All_Clear_Element)) || (!state && (*pbuffer != All_Set_Element)))
695 while (
bit < active_bits)
698 if (((*pbuffer & mask) != 0) == state)
720 const_pointer rhs_pbuffer,
721 size_t ) ETL_NOEXCEPT
723 *lhs_pbuffer = *rhs_pbuffer;
733 const_pointer rhs_pbuffer,
734 size_t ) ETL_NOEXCEPT
736 *lhs_pbuffer &= *rhs_pbuffer;
746 const_pointer rhs_pbuffer,
747 size_t ) ETL_NOEXCEPT
749 *lhs_pbuffer |= *rhs_pbuffer;
759 const_pointer rhs_pbuffer,
760 size_t ) ETL_NOEXCEPT
762 *lhs_pbuffer ^= *rhs_pbuffer;
772 size_t ) ETL_NOEXCEPT
774 *pbuffer = ~*pbuffer;
785 size_t shift) ETL_NOEXCEPT
787 if (shift >= active_bits)
805 size_t shift) ETL_NOEXCEPT
807 if (shift >= active_bits)
823 const_pointer rhs_pbuffer,
824 size_t ) ETL_NOEXCEPT
826 return (*lhs_pbuffer == *rhs_pbuffer);
832 template <
typename TElementType>
837 unsigned long long value) ETL_NOEXCEPT
839 *pbuffer =
static_cast<TElementType
>(
value);
849 size_t ) ETL_NOEXCEPT
851 element_type temp = *lhs_pbuffer;
852 *lhs_pbuffer = *rhs_pbuffer;
861 template <
typename TElement>
870 using typename etl::private_bitset::bitset_impl_common<TElement>::element_type;
871 using typename etl::private_bitset::bitset_impl_common<TElement>::pointer;
872 using typename etl::private_bitset::bitset_impl_common<TElement>::const_pointer;
883 template <
size_t Position,
size_t Length,
size_t Bits_Per_Element>
886 static ETL_CONSTANT
bool value = ((Position + Length - 1) >> etl::log2<Bits_Per_Element>::value) == (Position >> etl::log2<Bits_Per_Element>::value);
895 bool test(const_pointer pbuffer,
896 size_t position) ETL_NOEXCEPT
898 size_t index = position >> etl::log2<Bits_Per_Element>::value;
899 element_type mask = element_type(1) << (position & (Bits_Per_Element - 1));
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)
954 bool none(const_pointer pbuffer,
955 size_t number_of_elements) ETL_NOEXCEPT
957 while (number_of_elements-- != 0)
973 bool any(const_pointer pbuffer,
974 size_t number_of_elements) ETL_NOEXCEPT
976 bool any_set =
false;
978 while (number_of_elements-- != 0)
980 if (*pbuffer++ != All_Clear_Element)
996 size_t number_of_elements,
997 element_type top_mask) ETL_NOEXCEPT
999 while (number_of_elements-- != 1U)
1001 *pbuffer++ = All_Set_Element;
1004 *pbuffer = (All_Set_Element & top_mask);
1014 bool value =
true) ETL_NOEXCEPT
1016 size_t index = position >> etl::log2<Bits_Per_Element>::value;
1017 element_type
bit = element_type(1) << (position & (Bits_Per_Element - 1));
1021 pbuffer[index] |=
bit;
1025 pbuffer[index] &=
~bit;
1032 template <
size_t Position>
1038 size_t index = Position >> etl::log2<Bits_Per_Element>::value;
1039 element_type
bit = element_type(1) << (Position & (Bits_Per_Element - 1));
1043 pbuffer[index] |=
bit;
1047 pbuffer[index] &=
~bit;
1054 template <
size_t Position,
bool Value>
1059 size_t index = Position >> etl::log2<Bits_Per_Element>::value;
1060 element_type
bit = element_type(1) << (Position & (Bits_Per_Element - 1));
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;
1098 size_t i = etl::min(total_bits, string_length);
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;
1133 size_t i = etl::min(total_bits, string_length);
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;
1168 size_t i = etl::min(total_bits, string_length);
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;
1203 size_t i = etl::min(total_bits, string_length);
1218 size_t number_of_elements) ETL_NOEXCEPT
1220 while (number_of_elements-- != 0U)
1222 *pbuffer++ = All_Clear_Element;
1232 size_t position) ETL_NOEXCEPT
1234 const size_t index = position >> etl::log2<Bits_Per_Element>::value;;
1235 const element_type
bit = element_type(1) << (position & (Bits_Per_Element - 1));
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);
1255 uint_least8_t shift = 0U;
1257 for (
size_t i = 0UL; i < number_of_elements; ++i)
1260 shift += uint_least8_t(Bits_Per_Element);
1270 template <
typename T>
1275 size_t active_bits_in_msb,
1276 size_t length) ETL_NOEXCEPT
1280 unsigned_t
value(0);
1283 if (active_bits_in_msb < Bits_Per_Element)
1285 element_type mask = etl::make_lsb_mask< element_type>(active_bits_in_msb);
1286 value = pbuffer[element_index] & mask;
1287 length -= active_bits_in_msb;
1288 if (length >= Bits_Per_Element)
1296 while (length >= Bits_Per_Element)
1298 value |= pbuffer[element_index];
1299 length -= Bits_Per_Element;
1300 if (length >= Bits_Per_Element)
1311 element_type mask = etl::make_lsb_mask< element_type>(length);
1312 value |= (pbuffer[element_index] >> (Bits_Per_Element - length)) & mask;
1322 template <
typename T>
1327 size_t length) ETL_NOEXCEPT
1331 unsigned_t
value(0);
1333 const int Msb_Element_Index = (position + length - 1) >> etl::log2<Bits_Per_Element>::value;
1334 const int Lsb_Element_Index = position >> etl::log2<Bits_Per_Element>::value;
1337 if (Msb_Element_Index == Lsb_Element_Index)
1339 const unsigned_t Mask = etl::make_lsb_mask< unsigned_t>(length);
1340 const unsigned_t Shift = position % Bits_Per_Element;
1342 value =
static_cast<unsigned_t
>(pbuffer[Msb_Element_Index] >> Shift) & Mask;
1347 size_t active_bits_in_msb = (position + length) - (Msb_Element_Index * Bits_Per_Element);
1350 int element_index = Msb_Element_Index;
1362 template <
typename T,
size_t Position,
size_t Length>
1370 const int Element_Index = (Position + Length - 1) >> etl::log2<Bits_Per_Element>::value;
1371 const unsigned_t Mask = etl::lsb_mask<unsigned_t, Length>::value;
1372 const unsigned_t Shift = Position % Bits_Per_Element;
1374 return static_cast<unsigned_t
>(pbuffer[Element_Index] >> Shift) & Mask;
1381 template <
typename T,
size_t Position,
size_t Length>
1388 const int Msb_Element_Index = (Position + Length - 1) >> etl::log2<Bits_Per_Element>::value;
1391 const size_t Active_Bits_In_Msb = ((Position + Length - 1) % Bits_Per_Element) + 1;
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
1455 size_t position) ETL_NOEXCEPT
1457 const size_t index = position >> etl::log2<Bits_Per_Element>::value;;
1458 const element_type
bit = element_type(1) << (position & (Bits_Per_Element - 1));
1460 pbuffer[index] ^=
bit;
1472 size_t number_of_elements,
1475 size_t position) ETL_NOEXCEPT
1478 size_t index = position >> log2<Bits_Per_Element>::value;
1479 size_t bit = position & (Bits_Per_Element - 1);
1481 element_type mask = 1 <<
bit;
1484 while (index < number_of_elements)
1486 element_type
value = pbuffer[index];
1489 if ((state && (
value != All_Clear_Element)) ||
1490 (!state && (
value != All_Set_Element)))
1493 while ((
bit < Bits_Per_Element) && (position < total_bits))
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)
1535 result.resize(active_bits,
'\0');
1540 for (
size_t i = active_bits; i > 0; --i)
1542 result[active_bits - i] =
test(pbuffer, i - 1) ? one : zero;
1554 const_pointer rhs_pbuffer,
1555 size_t number_of_elements) ETL_NOEXCEPT
1557 while (number_of_elements-- != 0)
1559 *lhs_pbuffer = *rhs_pbuffer;
1571 const_pointer rhs_pbuffer,
1572 size_t number_of_elements) ETL_NOEXCEPT
1574 while (number_of_elements-- != 0)
1576 *lhs_pbuffer &= *rhs_pbuffer;
1588 const_pointer rhs_pbuffer,
1589 size_t number_of_elements) ETL_NOEXCEPT
1591 while (number_of_elements-- != 0)
1593 *lhs_pbuffer |= *rhs_pbuffer;
1605 const_pointer rhs_pbuffer,
1606 size_t number_of_elements) ETL_NOEXCEPT
1608 while (number_of_elements-- != 0)
1610 *lhs_pbuffer ^= *rhs_pbuffer;
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
1641 if (shift >= active_bits)
1648 const size_t split_position = Bits_Per_Element - (shift % Bits_Per_Element);
1651 int src_index = int(number_of_elements - (shift / Bits_Per_Element) - 1U);
1654 int dst_index = int(number_of_elements - 1U);
1657 const size_t lsb_shift = Bits_Per_Element - split_position;
1658 const size_t msb_shift = split_position;
1662 const element_type lsb_shifted_mask = element_type(
lsb_mask << lsb_shift);
1665 element_type lsb = element_type((pbuffer[src_index] &
lsb_mask) << lsb_shift);
1666 pbuffer[dst_index] = lsb;
1670 while (src_index >= 0)
1673 element_type msb = element_type((pbuffer[src_index] &
msb_mask) >> msb_shift);
1674 pbuffer[dst_index] = pbuffer[dst_index] | msb;
1678 lsb = element_type((pbuffer[src_index] &
lsb_mask) << lsb_shift);
1679 pbuffer[dst_index] = lsb;
1685 pbuffer[dst_index] &= lsb_shifted_mask;
1688 for (
int i = 0; i < dst_index; ++i)
1701 size_t number_of_elements,
1703 size_t shift) ETL_NOEXCEPT
1705 if (shift >= active_bits)
1712 const size_t split_position = shift % Bits_Per_Element;
1715 int src_index = int(shift / Bits_Per_Element);
1721 const size_t lsb_shift = Bits_Per_Element - split_position;
1722 const size_t msb_shift = split_position;
1726 const element_type msb_shifted_mask = element_type(
msb_mask >> msb_shift);
1729 while (src_index <
int(number_of_elements - 1))
1732 element_type msb = element_type((pbuffer[src_index] &
msb_mask) >> msb_shift);
1736 element_type lsb = element_type((pbuffer[src_index] &
lsb_mask) << lsb_shift);
1739 pbuffer[dst_index] = lsb | msb;
1744 element_type msb = element_type((pbuffer[src_index] &
msb_mask) >> msb_shift);
1745 pbuffer[dst_index] = msb;
1749 pbuffer[dst_index] &= msb_shifted_mask;
1753 while (dst_index <
int(number_of_elements))
1755 pbuffer[dst_index] = 0;
1767 const_pointer rhs_pbuffer,
1768 size_t number_of_elements) ETL_NOEXCEPT
1770 return etl::equal(lhs_pbuffer, lhs_pbuffer + number_of_elements, rhs_pbuffer);
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;
1821 while (i != number_of_elements)
1823 pbuffer[i++] = All_Clear_Element;
1834 size_t number_of_elements)
1836 etl::swap_ranges(pbuffer1, pbuffer1 + number_of_elements, pbuffer2);
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;
1859 static ETL_CONSTANT
etl::bitset_storage_model Storage_Model = (bitset_common<Active_Bits, TElement>::Number_Of_Elements == 1U) ? etl::bitset_storage_model::Single : etl::bitset_storage_model::Multi;
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>
1878 ETL_CONSTANT
size_t bitset_common<Active_Bits, TElement>::Number_Of_Elements;
1880 template <
size_t Active_Bits,
typename TElement>
1881 ETL_CONSTANT
size_t bitset_common<Active_Bits, TElement>::Size;
1884 template <
size_t Active_Bits,
typename TElement>
1887 template <
size_t Active_Bits,
typename TElement>
1891 template <
size_t Active_Bits,
typename TElement>
1892 ETL_CONSTANT
size_t bitset_common<Active_Bits, TElement>::Top_Mask_Shift;
1894 template <
size_t Active_Bits,
typename TElement>
1895 ETL_CONSTANT TElement bitset_common<Active_Bits, TElement>::Top_Mask;
1901 template <
size_t Active_Bits = 0U,
1902 typename TElement =
unsigned char>
1913 typedef etl::private_bitset::bitset_common<0U, unsigned char>::element_type element_type;
1914 typedef etl::private_bitset::bitset_common<0U, unsigned char>::span_type span_type;
1915 typedef etl::private_bitset::bitset_common<0U, unsigned char>::const_span_type const_span_type;
1930 template <
size_t Active_Bits,
typename TElement>
1937 typedef typename etl::private_bitset::bitset_common<Active_Bits, TElement>::element_type element_type;
1938 typedef typename etl::private_bitset::bitset_common<Active_Bits, TElement>::span_type span_type;
1939 typedef typename etl::private_bitset::bitset_common<Active_Bits, TElement>::const_span_type const_span_type;
1959 friend class bitset;
1965 : p_bitset(other.p_bitset)
1966 , position(other.position)
1973 ETL_CONSTEXPR14
operator bool() const ETL_NOEXCEPT
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)
2028 : p_bitset(&r_bitset)
2029 , position(position_)
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");
2146 implementation::template set_position<Position>(buffer,
value);
2154 template <
size_t Position,
bool Value>
2157 ETL_STATIC_ASSERT(Position < Active_Bits,
"Position out of bounds");
2159 implementation::template set_position<Position, Value>(buffer);
2167 template <
typename TPString>
2170 set(TPString text) ETL_NOEXCEPT
2172 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2180 template <
typename TPString>
2183 set(TPString text) ETL_NOEXCEPT
2185 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2193 template <
typename TPString>
2196 set(TPString text) ETL_NOEXCEPT
2198 implementation::from_string(buffer, Number_Of_Elements, Active_Bits, text);
2206 template <
typename TPString>
2209 set(TPString text) ETL_NOEXCEPT
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>
2264 ETL_STATIC_ASSERT(etl::is_integral<T>::value,
"Only integral types are supported");
2267 return implementation::template
value<T>(buffer, Number_Of_Elements);
2274 template <
typename T>
2278 ETL_STATIC_ASSERT(etl::is_integral<T>::value,
"Only integral types are supported");
2281 ETL_ASSERT_OR_RETURN_VALUE((position + length) <= Active_Bits, ETL_ERROR(
bitset_overflow), 0);
2283 return implementation::template
extract<T>(buffer, position, length);
2291 template <typename T, size_t Position, size_t Length = etl::integral_limits<T>::bits>
2293 template <
typename T,
size_t Position,
size_t Length>
2298 ETL_STATIC_ASSERT(etl::is_integral<T>::value,
"Only integral types are supported");
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;
2439 ETL_CONSTEXPR14
size_t count() const ETL_NOEXCEPT
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);
2465 ETL_CONSTEXPR14
bool none() const ETL_NOEXCEPT
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);
2483 ETL_CONSTEXPR14
bool any() const ETL_NOEXCEPT
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>
2544 ETL_CONSTEXPR14 TString
to_string(
typename TString::value_type zero =
typename TString::value_type(
'0'),
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);
2720 return !(lhs == rhs);
2728 implementation::swap(buffer, other.buffer, Number_Of_Elements);
2735 ETL_CONSTEXPR14 span_type
span() ETL_NOEXCEPT
2737 return span_type(buffer, Number_Of_Elements);
2744 ETL_CONSTEXPR14 const_span_type
span() const ETL_NOEXCEPT
2746 return const_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;
2834 typedef etl::private_bitset::bitset_common<0U, unsigned char>::element_type element_type;
2835 typedef etl::private_bitset::bitset_common<0U, unsigned char>::span_type span_type;
2836 typedef etl::private_bitset::bitset_common<0U, unsigned char>::const_span_type const_span_type;
2851 template <
size_t Active_Bits,
typename TElement>
2858 typedef size_t size_type;
2860 typedef typename etl::private_bitset::bitset_common<Active_Bits, TElement>::element_type element_type;
2861 typedef typename etl::private_bitset::bitset_common<Active_Bits, TElement>::span_type span_type;
2862 typedef typename etl::private_bitset::bitset_common<Active_Bits, TElement>::const_span_type const_span_type;
2882 friend class bitset_ext;
2888 : p_bitset(other.p_bitset)
2889 , position(other.position)
2896 ETL_CONSTEXPR14
operator bool() const ETL_NOEXCEPT
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)
2951 : p_bitset(&r_bitset)
2952 , position(position_)
2956 bitset_ext<Active_Bits, TElement>* p_bitset;
2967 implementation::reset_all(pbuffer, Number_Of_Elements);
2974 : pbuffer(buffer.data())
2977 implementation::reset_all(pbuffer, Number_Of_Elements);
2987 implementation::operator_assignment(pbuffer, other.pbuffer, Number_Of_Elements);
2994 : pbuffer(buffer.data())
2996 implementation::operator_assignment(pbuffer, other.pbuffer, Number_Of_Elements);
3011 implementation::template initialise<element_type>(pbuffer, Number_Of_Elements,
value);
3017 template <
typename TValue>
3019 : pbuffer(buffer.data())
3021 implementation::template initialise<element_type>(pbuffer, Number_Of_Elements,
value);
3027 template <
typename TPString>
3032 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3038 template <
typename TPString>
3040 : pbuffer(buffer.data())
3042 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3048 template <
typename TPString>
3053 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3059 template <
typename TPString>
3061 : pbuffer(buffer.data())
3063 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3069 template <
typename TPString>
3074 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3080 template <
typename TPString>
3082 : pbuffer(buffer.data())
3084 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3090 template <
typename TPString>
3095 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3101 template <
typename TPString>
3103 : pbuffer(buffer.data())
3105 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3113 implementation::operator_assignment(pbuffer, other.pbuffer, Number_Of_Elements);
3123 implementation::set_all(pbuffer, Number_Of_Elements, Top_Mask);
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>
3147 ETL_STATIC_ASSERT(Position < Active_Bits,
"Position out of bounds");
3149 implementation::template set_position<Position>(pbuffer,
value);
3157 template <
size_t Position,
bool Value>
3160 ETL_STATIC_ASSERT(Position < Active_Bits,
"Position out of bounds");
3162 implementation::template set_position<Position, Value>(pbuffer);
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);
3224 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3234 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3244 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3254 implementation::from_string(pbuffer, Number_Of_Elements, Active_Bits, text);
3262 template <
typename T>
3266 ETL_STATIC_ASSERT(etl::is_integral<T>::value,
"Only integral types are supported");
3269 return implementation::template
value<T>(pbuffer, Number_Of_Elements);
3276 template <
typename T>
3280 ETL_STATIC_ASSERT(etl::is_integral<T>::value,
"Only integral types are supported");
3283 ETL_ASSERT_OR_RETURN_VALUE((position + length) <= Active_Bits, ETL_ERROR(
bitset_overflow), 0);
3285 return implementation::template
extract<T>(pbuffer, position, length);
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>
3300 ETL_STATIC_ASSERT(etl::is_integral<T>::value,
"Only integral types are supported");
3302 ETL_STATIC_ASSERT((Position + Length) <= Active_Bits,
"Position/Length overflows bitset");
3332 implementation::reset_all(pbuffer, Number_Of_Elements);
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>
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
3385 return Number_Of_Elements;
3393 return All_Set_Element;
3401 return All_Clear_Element;
3407 static ETL_CONSTEXPR element_type
top_mask() ETL_NOEXCEPT
3417 return Bits_Per_Element;
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);
3505 implementation::flip_all(pbuffer, Number_Of_Elements);
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);
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
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);
3578 implementation::operator_and(&pbuffer[0], &other.pbuffer[0], Number_Of_Elements);
3588 implementation::operator_or(&pbuffer[0], &other.pbuffer[0], Number_Of_Elements);
3598 implementation::operator_xor(&pbuffer[0], &other.pbuffer[0], Number_Of_Elements);
3608 implementation::operator_shift_left(pbuffer, Number_Of_Elements, Active_Bits, shift);
3618 implementation::operator_shift_right(pbuffer, Number_Of_Elements, Active_Bits, shift);
3628 return implementation::operator_equality(lhs.pbuffer, rhs.pbuffer, lhs.Number_Of_Elements);
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);
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>
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>
3755 typename etl::bitset<Active_Bits, TLhsElement>::const_span_type lhs_span = lhs.span();
3756 typename etl::bitset<Active_Bits, TRhsElement>::const_span_type rhs_span = rhs.span();
3759 if ETL_IF_CONSTEXPR(
sizeof(TLhsElement) >
sizeof(TRhsElement))
3775template<
size_t Active_Bits,
typename TLhsElement,
typename TRhsElement>
3780 return !(lhs == rhs);
3789template<
size_t Active_Bits,
typename TLhsElement,
typename TRhsElement>
3795 typename etl::bitset_ext<Active_Bits, TLhsElement>::const_span_type lhs_span = lhs.span();
3796 typename etl::bitset_ext<Active_Bits, TRhsElement>::const_span_type rhs_span = rhs.span();
3799 if ETL_IF_CONSTEXPR(
sizeof(TLhsElement) >
sizeof(TRhsElement))
3815template<
size_t Active_Bits,
typename TLhsElement,
typename TRhsElement>
3820 return !(lhs == rhs);
3828template<
size_t Active_Bits,
typename TElement>
3832 const char Storage_Model = etl::bitset<Active_Bits, TElement>::Storage_Model;
3833 const size_t Number_Of_Elements = etl::bitset<Active_Bits, TElement>::Number_Of_Elements;
3835 typename etl::bitset<Active_Bits, TElement>::const_span_type lhs_span = lhs.span();
3836 typename etl::bitset_ext<Active_Bits, TElement>::const_span_type rhs_span = rhs.span();
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>
3864 const char Storage_Model = etl::bitset<Active_Bits, TElement>::Storage_Model;
3865 const size_t Number_Of_Elements = etl::bitset<Active_Bits, TElement>::Number_Of_Elements;
3867 typename etl::bitset_ext<Active_Bits, TElement>::const_span_type lhs_span = lhs.span();
3868 typename etl::bitset<Active_Bits, TElement>::const_span_type rhs_span = rhs.span();
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>
3898 typename etl::bitset<Active_Bits, TLhsElement>::const_span_type lhs_span = lhs.span();
3899 typename etl::bitset_ext<Active_Bits, TRhsElement>::const_span_type rhs_span = rhs.span();
3902 if ETL_IF_CONSTEXPR(
sizeof(TLhsElement) >
sizeof(TRhsElement))
3917template<
size_t Active_Bits,
typename TLhsElement,
typename TRhsElement>
3922 return !(lhs == rhs);
3930template<
size_t Active_Bits,
typename TLhsElement,
typename TRhsElement>
3936 typename etl::bitset_ext<Active_Bits, TLhsElement>::const_span_type lhs_span = lhs.span();
3937 typename etl::bitset<Active_Bits, TRhsElement>::const_span_type rhs_span = rhs.span();
3940 if ETL_IF_CONSTEXPR(
sizeof(TLhsElement) >
sizeof(TRhsElement))
3955template<
size_t Active_Bits,
typename TLhsElement,
typename TRhsElement>
3960 return !(lhs == rhs);
ETL_CONSTEXPR14 void swap(etl::bitset< Active_Bits, TElement > &lhs, etl::bitset< Active_Bits, TElement > &rhs) ETL_NOEXCEPT
swap
Definition bitset_new.h:2809
bool compare_bitset_spans(const TLhsSpan &lhs_span, const TRhsSpan &rhs_span)
Definition bitset_new.h:3703
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
A bitset that uses externally declared storage.
Definition bitset_new.h:2853
ETL_CONSTEXPR14 etl::enable_if< etl::is_same< TPString, constchar32_t * >::value, bitset_ext< Active_Bits, TElement > & >::type set(TPString text) ETL_NOEXCEPT
Set from a char32 string.
Definition bitset_new.h:3212
ETL_CONSTEXPR14 T extract() const
Definition bitset_new.h:3298
ETL_CONSTEXPR14 etl::enable_if< etl::is_same< TPString, constwchar_t * >::value, bitset_ext< Active_Bits, TElement > & >::type set(TPString text) ETL_NOEXCEPT
Set from a wide string.
Definition bitset_new.h:3186
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & from_string(const char32_t *text) ETL_NOEXCEPT
Set from a u32 string.
Definition bitset_new.h:3252
ETL_CONSTEXPR14 bitset_ext & operator=(const bitset_ext< Active_Bits, TElement > &other) ETL_NOEXCEPT
Assignment operator.
Definition bitset_new.h:3111
ETL_CONSTEXPR14 bool any() const ETL_NOEXCEPT
Are any of the bits set?
Definition bitset_new.h:3485
ETL_CONSTEXPR14 bitset_ext(TPString text, buffer_type &buffer, typename etl::enable_if< is_same< TPString, const char16_t * >::value >::type *=0) ETL_NOEXCEPT
Construct from a string.
Definition bitset_new.h:3081
static ETL_CONSTEXPR element_type all_set_element() ETL_NOEXCEPT
The value of a set element.
Definition bitset_new.h:3391
ETL_CONSTEXPR14 void swap(etl::bitset_ext< Active_Bits, TElement > &other) ETL_NOEXCEPT
swap
Definition bitset_new.h:3642
friend ETL_CONSTEXPR14 bool operator==(const bitset_ext< Active_Bits, TElement > &lhs, const bitset_ext< Active_Bits, TElement > &rhs) ETL_NOEXCEPT
operator ==
Definition bitset_new.h:3626
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & flip(size_t position)
Flip the bit at the position.
Definition bitset_new.h:3513
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & from_string(const char *text) ETL_NOEXCEPT
Set from a string.
Definition bitset_new.h:3222
ETL_CONSTEXPR14 size_t find_next(bool state, size_t position) const ETL_NOEXCEPT
Definition bitset_new.h:3568
static ETL_CONSTEXPR element_type top_mask() ETL_NOEXCEPT
The mask for the msb element.
Definition bitset_new.h:3407
ETL_CONSTEXPR14 bitset_ext(TPString text, element_type *pbuffer_, typename etl::enable_if< is_same< TPString, const char * >::value >::type *=0)
Construct from a string.
Definition bitset_new.h:3028
ETL_CONSTEXPR14 bitset_ext(TValue value, buffer_type &buffer, typename etl::enable_if< is_integral< TValue >::value >::type *=0) ETL_NOEXCEPT
Construct from a value.
Definition bitset_new.h:3018
ETL_CONSTEXPR14 bitset_ext(TPString text, element_type *pbuffer_, typename etl::enable_if< is_same< TPString, const char16_t * >::value >::type *=0)
Construct from a string.
Definition bitset_new.h:3070
unsigned long long to_ullong() const
Get as an unsigned long long.
Definition bitset_new.h:3320
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & operator<<=(size_t shift) ETL_NOEXCEPT
operator <<=
Definition bitset_new.h:3606
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & operator|=(const bitset_ext< Active_Bits, TElement > &other) ETL_NOEXCEPT
operator |=
Definition bitset_new.h:3586
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & operator^=(const bitset_ext< Active_Bits, TElement > &other) ETL_NOEXCEPT
operator ^=
Definition bitset_new.h:3596
ETL_CONSTEXPR14 bool any(element_type mask) const ETL_NOEXCEPT
Are any of the mask bits set?
Definition bitset_new.h:3493
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & reset() ETL_NOEXCEPT
Reset all of the bits.
Definition bitset_new.h:3330
ETL_CONSTEXPR14 bool none() const ETL_NOEXCEPT
Are none of the bits set?
Definition bitset_new.h:3467
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & set() ETL_NOEXCEPT
Set all of the bits.
Definition bitset_new.h:3121
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & reset(size_t position)
Reset the bit at the position.
Definition bitset_new.h:3340
ETL_CONSTEXPR14 bitset_ext(TPString text, buffer_type &buffer, typename etl::enable_if< is_same< TPString, const wchar_t * >::value >::type *=0) ETL_NOEXCEPT
Construct from a string.
Definition bitset_new.h:3060
ETL_CONSTEXPR14 bitset_ext(element_type *pbuffer_)
Definition bitset_new.h:2963
ETL_CONSTEXPR14 T value() const ETL_NOEXCEPT
Get as an integral value.
Definition bitset_new.h:3264
ETL_CONSTEXPR14 bitset_ext(unsigned long long value, element_type *pbuffer_)
Construct from a value.
Definition bitset_new.h:3007
static ETL_CONSTEXPR size_t bits_per_element() ETL_NOEXCEPT
The number of bits in an element.
Definition bitset_new.h:3415
ETL_CONSTEXPR14 bitset_ext(TPString text, element_type *pbuffer_, typename etl::enable_if< is_same< TPString, const char32_t * >::value >::type *=0)
Construct from a string.
Definition bitset_new.h:3091
ETL_CONSTEXPR14 etl::enable_if< etl::is_same< TPString, constchar * >::value, bitset_ext< Active_Bits, TElement > & >::type set(TPString text) ETL_NOEXCEPT
Set from a string.
Definition bitset_new.h:3173
ETL_CONSTEXPR14 bool operator[](size_t position) const ETL_NOEXCEPT
Read [] operator.
Definition bitset_new.h:3525
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & operator&=(const bitset_ext< Active_Bits, TElement > &other) ETL_NOEXCEPT
operator &=
Definition bitset_new.h:3576
static ETL_CONSTEXPR size_t size() ETL_NOEXCEPT
The number of bits in the bitset.
Definition bitset_new.h:3375
static ETL_CONSTEXPR size_t number_of_elements() ETL_NOEXCEPT
The number of storage elements in the bitset.
Definition bitset_new.h:3383
ETL_CONSTEXPR14 bool test(size_t position) const
Definition bitset_new.h:3353
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & flip() ETL_NOEXCEPT
Flip all of the bits.
Definition bitset_new.h:3503
static ETL_CONSTEXPR size_t allocated_bits() ETL_NOEXCEPT
The total number of bits of storage, including unused.
Definition bitset_new.h:3423
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & set(size_t position, bool value=true)
Set the bit at the position.
Definition bitset_new.h:3132
ETL_CONSTEXPR14 bitset_ext(TPString text, element_type *pbuffer_, typename etl::enable_if< is_same< TPString, const wchar_t * >::value >::type *=0)
Construct from a string.
Definition bitset_new.h:3049
unsigned long to_ulong() const
Get as an unsigned long.
Definition bitset_new.h:3310
ETL_CONSTEXPR14 bool test() const
Definition bitset_new.h:3365
ETL_CONSTEXPR14 bitset_ext(TPString text, buffer_type &buffer, typename etl::enable_if< is_same< TPString, const char32_t * >::value >::type *=0) ETL_NOEXCEPT
Construct from a string.
Definition bitset_new.h:3102
ETL_CONSTEXPR14 etl::enable_if< etl::is_same< TPString, constchar16_t * >::value, bitset_ext< Active_Bits, TElement > & >::type set(TPString text) ETL_NOEXCEPT
Set from a char16 string.
Definition bitset_new.h:3199
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & from_string(const wchar_t *text) ETL_NOEXCEPT
Set from a wide string.
Definition bitset_new.h:3232
ETL_CONSTEXPR14 bool none(element_type mask) const ETL_NOEXCEPT
Are none of the mask bits set?
Definition bitset_new.h:3475
ETL_CONSTEXPR14 size_t count() const ETL_NOEXCEPT
Count the number of bits set.
Definition bitset_new.h:3441
ETL_CONSTEXPR14 bitset_ext(const bitset_ext< Active_Bits, TElement > &other, buffer_type &buffer) ETL_NOEXCEPT
Construct copy.
Definition bitset_new.h:2993
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & set()
Set the bit at the position.
Definition bitset_new.h:3158
ETL_CONSTEXPR14 bitset_ext(const bitset_ext< Active_Bits, TElement > &other, element_type *pbuffer_)
Construct copy.
Definition bitset_new.h:2983
static ETL_CONSTEXPR etl::bitset_storage_model storage_model() ETL_NOEXCEPT
Definition bitset_new.h:3433
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & operator>>=(size_t shift) ETL_NOEXCEPT
operator >>=
Definition bitset_new.h:3616
friend ETL_CONSTEXPR14 bool operator!=(const bitset_ext< Active_Bits, TElement > &lhs, const bitset_ext< Active_Bits, TElement > &rhs) ETL_NOEXCEPT
operator !=
Definition bitset_new.h:3634
ETL_CONSTEXPR14 size_t find_first(bool state) const ETL_NOEXCEPT
Definition bitset_new.h:3557
static ETL_CONSTEXPR element_type all_clear_element() ETL_NOEXCEPT
The value of a clear element.
Definition bitset_new.h:3399
ETL_CONSTEXPR14 const_span_type span() const ETL_NOEXCEPT
Definition bitset_new.h:3660
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & set(bool value=true)
Set the bit at the position.
Definition bitset_new.h:3145
ETL_CONSTEXPR14 bitset_ext(TPString text, buffer_type &buffer, typename etl::enable_if< is_same< TPString, const char * >::value >::type *=0) ETL_NOEXCEPT
Construct from a string.
Definition bitset_new.h:3039
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:3546
ETL_CONSTEXPR14 bitset_ext(const bitset_ext< Active_Bits, TElement > &other) ETL_NOEXCEPT ETL_DELETE
Copy Constructor (Deleted).
ETL_CONSTEXPR14 bitset_ext< Active_Bits, TElement > & from_string(const char16_t *text) ETL_NOEXCEPT
Set from a u16 string.
Definition bitset_new.h:3242
ETL_CONSTEXPR14 bitset_ext(buffer_type &buffer)
Default constructor.
Definition bitset_new.h:2973
ETL_CONSTEXPR14 span_type span() ETL_NOEXCEPT
Definition bitset_new.h:3651
ETL_CONSTEXPR14 T extract(size_t position, size_t length=etl::integral_limits< T >::bits)
Definition bitset_new.h:3278
Definition bitset_new.h:1845
Definition bitset_new.h:168
Span - Fixed Extent.
Definition span.h:138
ETL_NODISCARD ETL_CONSTEXPR iterator begin() const ETL_NOEXCEPT
Returns an iterator to the beginning of the span.
Definition span.h:350
#define ETL_DECLARE_ENUM_TYPE(TypeName, ValueType)
Definition enum_type.h:85
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:923
ETL_CONSTEXPR14 TReturn sign_extend(TValue value)
Definition binary.h:272
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
ibitset & initialise(unsigned long long value)
Initialise from an unsigned long long.
Definition bitset_legacy.h:1011
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
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
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_legacy.h:1359
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()
Definition bitset_legacy.h:1144
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
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
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
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 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
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
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:1254
is_same
Definition type_traits_generator.h:1104
is_unsigned
Definition type_traits_generator.h:1084
make_unsigned
Definition type_traits_generator.h:1244
bitset_ext
Definition absolute.h:39
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::byte operator^(etl::byte lhs, etl::byte rhs)
Exclusive Or.
Definition byte.h:281
ETL_CONSTEXPR14 size_t strlen(const T *t) ETL_NOEXCEPT
Alternative strlen for all character types.
Definition char_traits.h:287
Check to see if the requested extract is contained within one element.
Definition bitset_new.h:885