From c5c88ae010e059cf9596645f7b970008c0f9c492 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 13 Dec 2023 09:59:59 +0000 Subject: [PATCH] Work in progress --- include/etl/private/bitset_new.h | 48 ++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/include/etl/private/bitset_new.h b/include/etl/private/bitset_new.h index 2257b838..71fd8ea1 100644 --- a/include/etl/private/bitset_new.h +++ b/include/etl/private/bitset_new.h @@ -966,7 +966,7 @@ namespace etl //*************************************************************************** template ::bits == Active_Bits> + bool FitsInSingleElement = etl::integral_limits::bits >= Active_Bits> class bitset; //*************************************************************************** @@ -976,6 +976,20 @@ namespace etl template <> class bitset<0U, char, true> : public bitset_constants<> { + public: + + typedef char element_type; + + typedef element_type* pointer; + typedef const element_type* const_pointer; + + static ETL_CONSTANT size_t Bits_Per_Element = 0U; + static ETL_CONSTANT size_t Number_Of_Elements = 0U; + static ETL_CONSTANT size_t Allocated_Bits = 0U; + static ETL_CONSTANT element_type All_Set_Element = 0U; + static ETL_CONSTANT element_type All_Clear_Element = 0U; + static ETL_CONSTANT size_t Top_Mask_Shift = 0U; + static ETL_CONSTANT element_type Top_Mask = 0U; }; //*************************************************************************** @@ -984,11 +998,25 @@ namespace etl template <> class bitset<0U, char, false> : public bitset_constants<> { + public: + + typedef char element_type; + + typedef element_type* pointer; + typedef const element_type* const_pointer; + + static ETL_CONSTANT size_t Bits_Per_Element = 0U; + static ETL_CONSTANT size_t Number_Of_Elements = 0U; + static ETL_CONSTANT size_t Allocated_Bits = 0U; + static ETL_CONSTANT element_type All_Set_Element = 0U; + static ETL_CONSTANT element_type All_Clear_Element = 0U; + static ETL_CONSTANT size_t Top_Mask_Shift = 0U; + static ETL_CONSTANT element_type Top_Mask = 0U; }; //*************************************************************************** - /// Specialisation that uses a single element if the element type is the - /// same size as the number of active bits. + /// Specialisation that uses a single element if the number of active bits + /// fits into the element type size. //*************************************************************************** template class bitset : public bitset_constants<> @@ -1177,16 +1205,6 @@ namespace etl return *this; } - //************************************************************************* - /// Set from a value. - //************************************************************************* - ETL_CONSTEXPR14 bitset& set(element_type value) ETL_NOEXCEPT - { - buffer = value; - - return *this; - } - //************************************************************************* /// Set the bit at the position. //************************************************************************* @@ -3333,7 +3351,7 @@ namespace etl //************************************************************************* /// The number of bits in the bitset. //************************************************************************* - ETL_CONSTEXPR14 size_t size() const ETL_NOEXCEPT + ETL_CONSTEXPR14 size_t size() const ETL_NOEXCEPT { return Active_Bits; } @@ -4143,7 +4161,7 @@ namespace etl //************************************************************************* /// The number of bits in the bitset. //************************************************************************* - ETL_CONSTEXPR14 size_t size() const ETL_NOEXCEPT + ETL_CONSTEXPR14 size_t size() const ETL_NOEXCEPT { return Active_Bits; }