mirror of
https://github.com/ETLCPP/etl.git
synced 2026-11-09 14:49:53 +08:00
Merge branch 'hotfix/bitset-iteration-error' into development
This commit is contained in:
commit
d071acf02a
@ -589,7 +589,7 @@ namespace etl
|
||||
|
||||
// Needs checking?
|
||||
if ((state && (value != ALL_CLEAR)) ||
|
||||
(!state && (value != ALL_SET)))
|
||||
(!state && (value != ALL_SET)))
|
||||
{
|
||||
// For each bit in the element...
|
||||
while ((bit < BITS_PER_ELEMENT) && (position < NBITS))
|
||||
@ -608,7 +608,7 @@ namespace etl
|
||||
}
|
||||
else
|
||||
{
|
||||
position += BITS_PER_ELEMENT;
|
||||
position += BITS_PER_ELEMENT - bit;
|
||||
}
|
||||
|
||||
// Start at the beginning for all other elements.
|
||||
|
||||
@ -1012,6 +1012,24 @@ namespace
|
||||
CHECK_EQUAL(4U, data.find_next(true, 1));
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_find_next_github_issue_336)
|
||||
{
|
||||
etl::bitset<16> bits16;
|
||||
bits16.set(12);
|
||||
|
||||
etl::bitset<24> bits24;
|
||||
bits24.set(12);
|
||||
|
||||
CHECK_EQUAL(12, bits16.find_first(true));
|
||||
CHECK_EQUAL(12, bits16.find_next(true, 4));
|
||||
CHECK_EQUAL(16, bits16.find_next(true, 13));
|
||||
|
||||
CHECK_EQUAL(12, bits24.find_first(true));
|
||||
CHECK_EQUAL(12, bits24.find_next(true, 4));
|
||||
CHECK_EQUAL(24, bits16.find_next(true, 13));
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(test_swap)
|
||||
{
|
||||
|
||||
@ -456,6 +456,22 @@ namespace
|
||||
CHECK((etl::is_same<etl::make_signed<const int>::type, std::make_signed<const int>::type>::value));
|
||||
CHECK((etl::is_same<etl::make_signed<const volatile int>::type, std::make_signed<const volatile int>::type>::value));
|
||||
CHECK((etl::is_same<etl::make_signed<size_t>::type, std::make_signed<size_t>::type>::value));
|
||||
|
||||
enum class ue : uint8_t
|
||||
{
|
||||
One,
|
||||
Two
|
||||
};
|
||||
|
||||
CHECK((etl::is_same<etl::make_signed<__underlying_type(ue)>::type, std::make_signed<ue>::type>::value));
|
||||
|
||||
enum class se : int8_t
|
||||
{
|
||||
One,
|
||||
Two
|
||||
};
|
||||
|
||||
CHECK((etl::is_same<etl::make_signed<__underlying_type(se)>::type, std::make_signed<se>::type>::value));
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
@ -482,6 +498,22 @@ namespace
|
||||
CHECK((etl::is_same<etl::make_unsigned<const int>::type, std::make_unsigned<const int>::type>::value));
|
||||
CHECK((etl::is_same<etl::make_unsigned<const volatile int>::type, std::make_unsigned<const volatile int>::type>::value));
|
||||
CHECK((etl::is_same<etl::make_unsigned<size_t>::type, std::make_unsigned<size_t>::type>::value));
|
||||
|
||||
enum class ue : uint8_t
|
||||
{
|
||||
One,
|
||||
Two
|
||||
};
|
||||
|
||||
CHECK((etl::is_same<etl::make_unsigned<__underlying_type(ue)>::type, std::make_unsigned<ue>::type>::value));
|
||||
|
||||
enum class se : int8_t
|
||||
{
|
||||
One,
|
||||
Two
|
||||
};
|
||||
|
||||
CHECK((etl::is_same<etl::make_unsigned<__underlying_type(se)>::type, std::make_unsigned<se>::type>::value));
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user