mirror of
https://github.com/ETLCPP/etl.git
synced 2026-11-09 14:49:53 +08:00
#805 legacy etl::bitset set/reset does not work if the element type is greater than 8 bit
This commit is contained in:
parent
d17f422dac
commit
c75617c2b6
@ -151,10 +151,10 @@ namespace etl
|
||||
typedef typename etl::make_unsigned<ETL_BITSET_ELEMENT_TYPE>::type element_type;
|
||||
typedef element_type element_t; // Backward compatibility
|
||||
|
||||
static ETL_CONSTANT element_type ALL_SET = etl::integral_limits<element_type>::max;
|
||||
static ETL_CONSTANT element_type ALL_SET = etl::integral_limits<element_type>::max;
|
||||
static ETL_CONSTANT element_type ALL_CLEAR = 0;
|
||||
|
||||
static ETL_CONSTANT size_t Bits_Per_Element = etl::integral_limits<element_type>::bits;
|
||||
static ETL_CONSTANT size_t Bits_Per_Element = etl::integral_limits<element_type>::bits;
|
||||
|
||||
#if ETL_USING_CPP11
|
||||
typedef etl::span<element_type> span_type;
|
||||
@ -311,7 +311,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
ibitset& set()
|
||||
{
|
||||
::memset(pdata, 0xFF, Number_Of_Elements);
|
||||
etl::fill_n(pdata, Number_Of_Elements - 1U, ALL_SET);
|
||||
pdata[Number_Of_Elements - 1U] = Top_Mask;
|
||||
|
||||
return *this;
|
||||
@ -519,7 +519,7 @@ namespace etl
|
||||
return v;
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
//*************************************************************************
|
||||
/// Put to a unsigned long.
|
||||
//*************************************************************************
|
||||
unsigned long to_ulong() const
|
||||
@ -540,7 +540,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
ibitset& reset()
|
||||
{
|
||||
::memset(pdata, 0, Number_Of_Elements * sizeof(element_type));
|
||||
etl::fill_n(pdata, Number_Of_Elements, ALL_CLEAR);
|
||||
|
||||
return *this;
|
||||
}
|
||||
@ -582,10 +582,10 @@ namespace etl
|
||||
//*************************************************************************
|
||||
ibitset& flip()
|
||||
{
|
||||
for (size_t i = 0UL; i < Number_Of_Elements; ++i)
|
||||
{
|
||||
pdata[i] = ~pdata[i];
|
||||
}
|
||||
etl::transform_n(pdata,
|
||||
Number_Of_Elements,
|
||||
pdata,
|
||||
etl::binary_not<element_type>());
|
||||
|
||||
clear_unused_bits_in_msb();
|
||||
|
||||
|
||||
@ -440,10 +440,10 @@ namespace etl
|
||||
//*************************************************************************
|
||||
ETL_CONSTEXPR14 void flip(pointer pbuffer, size_t number_of_elements) ETL_NOEXCEPT
|
||||
{
|
||||
for (size_t i = 0UL; i < number_of_elements; ++i)
|
||||
{
|
||||
pbuffer[i] = ~pbuffer[i];
|
||||
}
|
||||
etl::transform_n(pbuffer,
|
||||
number_of_elements,
|
||||
pbuffer,
|
||||
etl::binary_not<element_type>());
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
@ -3340,12 +3340,6 @@
|
||||
<None Include="..\..\appveyor.yml">
|
||||
<Filter>Resource Files\CI\Appveyor</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.github\workflows\clang.yml">
|
||||
<Filter>Resource Files\CI\Github</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.github\workflows\gcc.yml">
|
||||
<Filter>Resource Files\CI\Github</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.clang-format">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
@ -3412,6 +3406,30 @@
|
||||
<None Include="..\..\scripts\update_version.py">
|
||||
<Filter>Tests\Scripts</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.github\workflows\clang-c++11.yml">
|
||||
<Filter>Resource Files\CI\Github</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.github\workflows\clang-c++14.yml">
|
||||
<Filter>Resource Files\CI\Github</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.github\workflows\clang-c++17.yml">
|
||||
<Filter>Resource Files\CI\Github</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.github\workflows\clang-c++20.yml">
|
||||
<Filter>Resource Files\CI\Github</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.github\workflows\gcc-c++11.yml">
|
||||
<Filter>Resource Files\CI\Github</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.github\workflows\gcc-c++14.yml">
|
||||
<Filter>Resource Files\CI\Github</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.github\workflows\gcc-c++17.yml">
|
||||
<Filter>Resource Files\CI\Github</Filter>
|
||||
</None>
|
||||
<None Include="..\..\.github\workflows\gcc-c++20.yml">
|
||||
<Filter>Resource Files\CI\Github</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="..\..\support\Release notes.txt">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user