diff --git a/.gitignore b/.gitignore index 9f430d3d..60f1643d 100644 --- a/.gitignore +++ b/.gitignore @@ -344,3 +344,5 @@ test/meson-logs test/meson-private test/build-make test/build-ninja +test/vs2019/Debug MSVC C++20 +test/vs2019/Debug MSVC C++20 - No STL diff --git a/include/etl/binary.h b/include/etl/binary.h index d4850155..fc253d12 100644 --- a/include/etl/binary.h +++ b/include/etl/binary.h @@ -46,6 +46,10 @@ SOFTWARE. #include "exception.h" #include "error_handler.h" +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + #include +#endif + namespace etl { //*************************************************************************** @@ -111,11 +115,15 @@ namespace etl template ETL_CONSTEXPR14 T rotate_left(T value) { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::rotl(value, 1); +#else ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); const size_t SHIFT = etl::integral_limits::type>::bits - 1; return (value << 1U) | (value >> SHIFT); +#endif } //*************************************************************************** @@ -125,6 +133,9 @@ namespace etl template ETL_CONSTEXPR14 T rotate_left(T value, size_t distance) { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::rotl(value, distance); +#else ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); const size_t BITS = etl::integral_limits::type>::bits; @@ -132,6 +143,7 @@ namespace etl const size_t SHIFT = BITS - distance; return (value << distance) | (value >> SHIFT); +#endif } //*************************************************************************** @@ -141,11 +153,15 @@ namespace etl template ETL_CONSTEXPR14 T rotate_right(T value) { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::rotr(value, 1); +#else ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); const size_t SHIFT = etl::integral_limits::type>::bits - 1; return (value >> 1U) | (value << SHIFT); +#endif } //*************************************************************************** @@ -155,6 +171,9 @@ namespace etl template ETL_CONSTEXPR14 T rotate_right(T value, size_t distance) { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::rotr(value, distance); +#else ETL_STATIC_ASSERT(etl::is_integral::value, "Not an integral type"); const size_t BITS = etl::integral_limits::type>::bits; @@ -162,6 +181,7 @@ namespace etl const size_t SHIFT = BITS - distance; return (value >> distance) | (value << SHIFT); +#endif } //*************************************************************************** @@ -209,7 +229,7 @@ namespace etl { ETL_STATIC_ASSERT(integral_limits::bits >= NBITS, "Return type too small to hold result"); - const TValue mask = etl::power<2, NBITS>::value - 1; + const TValue mask = etl::power<2, NBITS>::value - 1U; const size_t shift = NBITS; // Fold the value down to fit the width. @@ -707,7 +727,11 @@ namespace etl //*************************************************************************** inline ETL_CONSTEXPR uint16_t reverse_bytes(uint16_t value) { +#if ETL_CPP23_SUPPORTED && ETL_USING_STL + return std::byteswap(value); +#else return (value >> 8U) | (value << 8U); +#endif } inline ETL_CONSTEXPR int16_t reverse_bytes(int16_t value) @@ -721,10 +745,14 @@ namespace etl //*************************************************************************** inline ETL_CONSTEXPR14 uint32_t reverse_bytes(uint32_t value) { +#if ETL_CPP23_SUPPORTED && ETL_USING_STL + return std::byteswap(value); +#else value = ((value & 0xFF00FF00UL) >> 8U) | ((value & 0x00FF00FFUL) << 8U); value = (value >> 16U) | (value << 16U); return value; +#endif } inline ETL_CONSTEXPR14 int32_t reverse_bytes(int32_t value) @@ -739,11 +767,15 @@ namespace etl //*************************************************************************** inline ETL_CONSTEXPR14 uint64_t reverse_bytes(uint64_t value) { +#if ETL_CPP23_SUPPORTED && ETL_USING_STL + return std::byteswap(value); +#else value = ((value & 0xFF00FF00FF00FF00ULL) >> 8U) | ((value & 0x00FF00FF00FF00FFULL) << 8U); value = ((value & 0xFFFF0000FFFF0000ULL) >> 16U) | ((value & 0x0000FFFF0000FFFFULL) << 16U); value = (value >> 32U) | (value << 32U); return value; +#endif } inline ETL_CONSTEXPR14 int64_t reverse_bytes(int64_t value) @@ -759,11 +791,17 @@ namespace etl //*************************************************************************** inline ETL_CONSTEXPR14 uint8_t gray_to_binary(uint8_t value) { - value ^= (value >> 4U); - value ^= (value >> 2U); - value ^= (value >> 1U); + uint8_t value1 = value ^ (value >> 4U); + uint8_t value2 = value1 ^ (value1 >> 2U); + uint8_t value3 = value2 ^ (value2 >> 1U); - return value; + return value3; + + //value ^= (value >> 4U); + //value ^= (value >> 2U); + //value ^= (value >> 1U); + + //return value; } inline ETL_CONSTEXPR14 int8_t gray_to_binary(int8_t value) @@ -841,6 +879,9 @@ namespace etl //*************************************************************************** inline ETL_CONSTEXPR14 uint_least8_t count_bits(uint8_t value) { +#if ETL_CPP23_SUPPORTED && ETL_USING_STL + return std::popcount(value); +#else uint32_t count = 0U; count = value - ((value >> 1U) & 0x55U); @@ -848,6 +889,7 @@ namespace etl count = ((count >> 4U) + count) & 0x0FU; return uint_least8_t(count); +#endif } inline ETL_CONSTEXPR14 uint_least8_t count_bits(int8_t value) @@ -863,6 +905,9 @@ namespace etl //*************************************************************************** inline ETL_CONSTEXPR14 uint_least8_t count_bits(uint16_t value) { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::popcount(value); +#else uint32_t count = 0U; count = value - ((value >> 1U) & 0x5555U); @@ -871,6 +916,7 @@ namespace etl count = ((count >> 8U) + count) & 0x00FFU; return static_cast(count); +#endif } inline ETL_CONSTEXPR14 uint_least8_t count_bits(int16_t value) @@ -884,6 +930,9 @@ namespace etl //*************************************************************************** inline ETL_CONSTEXPR14 uint_least8_t count_bits(uint32_t value) { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::popcount(value); +#else uint32_t count = 0U; count = value - ((value >> 1U) & 0x55555555UL); @@ -892,7 +941,8 @@ namespace etl count = ((count >> 8U) + count) & 0x00FF00FFUL; count = ((count >> 16U) + count) & 0x0000FFUL; - return static_cast(count);; + return static_cast(count); +#endif } inline ETL_CONSTEXPR14 uint_least8_t count_bits(int32_t value) @@ -907,6 +957,9 @@ namespace etl //*************************************************************************** inline ETL_CONSTEXPR14 uint_least8_t count_bits(uint64_t value) { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::popcount(value); +#else uint64_t count = 0U; count = value - ((value >> 1U) & 0x5555555555555555ULL); @@ -917,6 +970,7 @@ namespace etl count = ((count >> 32U) + count) & 0x00000000FFFFFFFFULL; return static_cast(count); +#endif } inline ETL_CONSTEXPR14 uint_least8_t count_bits(int64_t value) @@ -1001,12 +1055,15 @@ namespace etl #if ETL_8BIT_SUPPORT //*************************************************************************** - /// Count trailing zeros. bit. + /// Count trailing zeros. /// Uses a binary search. ///\ingroup binary //*************************************************************************** inline ETL_CONSTEXPR14 uint_least8_t count_trailing_zeros(uint8_t value) { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::countr_zero(value); +#else uint_least8_t count = 0U; if (value & 0x1U) @@ -1029,10 +1086,17 @@ namespace etl count += 2U; } - count -= value & 0x1U; + if ((value & 0x1U) == 0U) + { + value >>= 1U; + count += 1U; + } + + count -= (value & 0x1U); } return count; +#endif } inline ETL_CONSTEXPR14 uint_least8_t count_trailing_zeros(int8_t value) @@ -1048,6 +1112,9 @@ namespace etl //*************************************************************************** inline ETL_CONSTEXPR14 uint_least8_t count_trailing_zeros(uint16_t value) { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::countr_zero(value); +#else uint_least8_t count = 0U; if (value & 0x1U) @@ -1076,10 +1143,17 @@ namespace etl count += 2U; } + if ((value & 0x1U) == 0U) + { + value >>= 1U; + count += 1U; + } + count -= value & 0x1U; } return count; +#endif } inline ETL_CONSTEXPR14 uint_least8_t count_trailing_zeros(int16_t value) @@ -1094,6 +1168,9 @@ namespace etl //*************************************************************************** inline ETL_CONSTEXPR14 uint_least8_t count_trailing_zeros(uint32_t value) { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::countr_zero(value); +#else uint_least8_t count = 0U; if (value & 0x1UL) @@ -1128,10 +1205,17 @@ namespace etl count += 2U; } + if ((value & 0x1U) == 0U) + { + value >>= 1U; + count += 1U; + } + count -= value & 0x1UL; } return count; +#endif } inline ETL_CONSTEXPR14 uint_least8_t count_trailing_zeros(int32_t value) @@ -1147,6 +1231,9 @@ namespace etl //*************************************************************************** ETL_CONSTEXPR14 inline uint_least8_t count_trailing_zeros(uint64_t value) { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::countr_zero(value); +#else uint_least8_t count = 0U; if (value & 0x1ULL) @@ -1187,10 +1274,17 @@ namespace etl count += 2U; } + if ((value & 0x1U) == 0U) + { + value >>= 1U; + count += 1U; + } + count -= value & 0x1ULL; } return count; +#endif } inline ETL_CONSTEXPR14 uint_least8_t count_trailing_zeros(int64_t value) @@ -1199,6 +1293,720 @@ namespace etl } #endif +#if ETL_8BIT_SUPPORT + //*************************************************************************** + /// Count trailing zeros. bit. + /// Uses a binary search. + ///\ingroup binary + //*************************************************************************** + inline ETL_CONSTEXPR14 uint_least8_t count_trailing_ones(uint8_t value) + { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::countr_one(value); +#else + uint_least8_t count = 0U; + + if ((value & 0x1U) == 0x0U) + { + count = 0U; + } + else + { + count = 1U; + + if ((value & 0xFU) == 0xFU) + { + value >>= 4U; + count += 4U; + } + + if ((value & 0x3U) == 0x3U) + { + value >>= 2U; + count += 2U; + } + + if ((value & 0x1U) == 0x1U) + { + value >>= 1U; + count += 1U; + } + + count -= ((value & 0x1U) == 0x0U); + } + + return count; +#endif + } + + inline ETL_CONSTEXPR14 uint_least8_t count_trailing_ones(int8_t value) + { + return count_trailing_ones(uint8_t(value)); + } +#endif + + //*************************************************************************** + /// Count trailing zeros. 16bit. + /// Uses a binary search. + ///\ingroup binary + //*************************************************************************** + inline ETL_CONSTEXPR14 uint_least8_t count_trailing_ones(uint16_t value) + { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::countr_one(value); +#else + uint_least8_t count = 0U; + + if ((value & 0x1U) == 0x0U) + { + count = 0U; + } + else + { + count = 1U; + + if ((value & 0xFFU) == 0xFFU) + { + value >>= 8U; + count += 8U; + } + + if ((value & 0xFU) == 0xFU) + { + value >>= 4U; + count += 4U; + } + + if ((value & 0x3U) == 0x3U) + { + value >>= 2U; + count += 2U; + } + + if ((value & 0x1U) == 0x1U) + { + value >>= 1U; + count += 1U; + } + + count -= ((value & 0x1U) == 0x0U); + } + + return count; +#endif + } + + inline ETL_CONSTEXPR14 uint_least8_t count_trailing_ones(int16_t value) + { + return count_trailing_ones(uint16_t(value)); + } + + //*************************************************************************** + /// Count trailing zeros. 32bit. + /// Uses a binary search. + ///\ingroup binary + //*************************************************************************** + inline ETL_CONSTEXPR14 uint_least8_t count_trailing_ones(uint32_t value) + { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::countr_one(value); +#else + uint_least8_t count = 0U; + + if ((value & 0x1UL) == 0x0UL) + { + count = 0U; + } + else + { + count = 1U; + + if ((value & 0xFFFFUL) == 0xFFFFUL) + { + value >>= 16U; + count += 16U; + } + + if ((value & 0xFFUL) == 0xFFUL) + { + value >>= 8U; + count += 8U; + } + + if ((value & 0xFUL) == 0xFUL) + { + value >>= 4U; + count += 4U; + } + + if ((value & 0x3UL) == 0x3UL) + { + value >>= 2U; + count += 2U; + } + + if ((value & 0x1UL) == 0x1UL) + { + value >>= 1U; + count += 1U; + } + + count -= ((value & 0x1UL) == 0x0UL); + } + + return count; +#endif + } + + inline ETL_CONSTEXPR14 uint_least8_t count_trailing_ones(int32_t value) + { + return count_trailing_ones(uint32_t(value)); + } + +#if ETL_USING_64BIT_TYPES + //*************************************************************************** + /// Count trailing zeros. 64bit. + /// Uses a binary search. + ///\ingroup binary + //*************************************************************************** + ETL_CONSTEXPR14 inline uint_least8_t count_trailing_ones(uint64_t value) + { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::countr_one(value); +#else + uint_least8_t count = 0U; + + if ((value & 0x1ULL) == 0x0ULL) + { + count = 0U; + } + else + { + count = 1U; + + if ((value & 0xFFFFULL) == 0xFFFFULL) + { + value >>= 16U; + count += 16U; + } + + if ((value & 0xFFULL) == 0xFFULL) + { + value >>= 8U; + count += 8U; + } + + if ((value & 0xFULL) == 0xFULL) + { + value >>= 4U; + count += 4U; + } + + if ((value & 0x3ULL) == 0x3ULL) + { + value >>= 2U; + count += 2U; + } + + if ((value & 0x1ULL) == 0x1ULL) + { + value >>= 1U; + count += 1U; + } + + count -= ((value & 0x1ULL) == 0x0ULL); + } + + return count; +#endif + } + + inline ETL_CONSTEXPR14 uint_least8_t count_trailing_ones(int64_t value) + { + return count_trailing_ones(uint64_t(value)); + } +#endif + +#if ETL_8BIT_SUPPORT + //*************************************************************************** + /// Count leading zeros. + /// Uses a binary search. + ///\ingroup binary + //*************************************************************************** + inline ETL_CONSTEXPR14 uint_least8_t count_leading_zeros(uint8_t value) + { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::countl_zero(value); +#else + uint_least8_t count = 0U; + + if (value & 0x80U) + { + count = 0U; + } + else + { + count = 1U; + + if ((value & 0xF0U) == 0U) + { + value <<= 4U; + count += 4U; + } + + if ((value & 0xC0U) == 0U) + { + value <<= 2U; + count += 2U; + } + + if ((value & 0x80U) == 0U) + { + value <<= 1U; + count += 1U; + } + + count -= ((value & 0x80U) == 0x80U); + } + + return count; +#endif + } + + inline ETL_CONSTEXPR14 uint_least8_t count_leading_zeros(int8_t value) + { + return count_leading_zeros(uint8_t(value)); + } +#endif + + //*************************************************************************** + /// Count leading zeros. + /// Uses a binary search. + ///\ingroup binary + //*************************************************************************** + inline ETL_CONSTEXPR14 uint_least8_t count_leading_zeros(uint16_t value) + { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::countl_zero(value); +#else + uint_least8_t count = 0U; + + if (value & 0x8000U) + { + count = 0U; + } + else + { + count = 1U; + + if ((value & 0xFF00U) == 0U) + { + value <<= 8U; + count += 8U; + } + + if ((value & 0xF000U) == 0U) + { + value <<= 4U; + count += 4U; + } + + if ((value & 0xC000U) == 0U) + { + value <<= 2U; + count += 2U; + } + + if ((value & 0x8000U) == 0U) + { + value <<= 1U; + count += 1U; + } + + count -= ((value & 0x8000U) == 0x8000U); + } + + return count; +#endif + } + + inline ETL_CONSTEXPR14 uint_least8_t count_leading_zeros(int16_t value) + { + return count_leading_zeros(uint16_t(value)); + } + + //*************************************************************************** + /// Count leading zeros. + /// Uses a binary search. + ///\ingroup binary + //*************************************************************************** + inline ETL_CONSTEXPR14 uint_least8_t count_leading_zeros(uint32_t value) + { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::countl_zero(value); +#else + uint_least8_t count = 0U; + + if (value & 0x80000000UL) + { + count = 0U; + } + else + { + count = 1U; + + if ((value & 0xFFFF0000UL) == 0U) + { + value <<= 16U; + count += 16U; + } + + if ((value & 0xFF000000UL) == 0U) + { + value <<= 8U; + count += 8U; + } + + if ((value & 0xF0000000UL) == 0U) + { + value <<= 4U; + count += 4U; + } + + if ((value & 0xC0000000UL) == 0U) + { + value <<= 2U; + count += 2U; + } + + if ((value & 0x80000000UL) == 0U) + { + value <<= 1U; + count += 1U; + } + + count -= ((value & 0x80000000UL) == 0x80000000UL); + } + + return count; +#endif + } + + inline ETL_CONSTEXPR14 uint_least8_t count_leading_zeros(int32_t value) + { + return count_leading_zeros(uint32_t(value)); + } + +#if ETL_USING_64BIT_TYPES + //*************************************************************************** + /// Count leading zeros. + /// Uses a binary search. + ///\ingroup binary + //*************************************************************************** + inline ETL_CONSTEXPR14 uint_least8_t count_leading_zeros(uint64_t value) + { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::countl_zero(value); +#else + uint_least8_t count = 0U; + + if (value & 0x8000000000000000ULL) + { + count = 0U; + } + else + { + count = 1U; + + if ((value & 0xFFFFFFFFF0000000ULL) == 0U) + { + value <<= 32U; + count += 32U; + } + + if ((value & 0xFFFF000000000000ULL) == 0U) + { + value <<= 16U; + count += 16U; + } + + if ((value & 0xFF00000000000000ULL) == 0U) + { + value <<= 8U; + count += 8U; + } + + if ((value & 0xF000000000000000ULL) == 0U) + { + value <<= 4U; + count += 4U; + } + + if ((value & 0xC000000000000000ULL) == 0U) + { + value <<= 2U; + count += 2U; + } + + if ((value & 0x8000000000000000ULL) == 0U) + { + value <<= 1U; + count += 1U; + } + + count -= ((value & 0x8000000000000000ULL) == 0x8000000000000000ULL); + } + + return count; +#endif + } + + inline ETL_CONSTEXPR14 uint_least8_t count_leading_zeros(int64_t value) + { + return count_leading_zeros(uint64_t(value)); + } +#endif + +#if ETL_8BIT_SUPPORT + //*************************************************************************** + /// Count leading ones. + /// Uses a binary search. + ///\ingroup binary + //*************************************************************************** + inline ETL_CONSTEXPR14 uint_least8_t count_leading_ones(uint8_t value) + { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::countl_one(value); +#else + uint_least8_t count = 0U; + + if ((value & 0x80U) == 0U) + { + count = 0U; + } + else + { + count = 1U; + + if ((value & 0xF0U) == 0xF0U) + { + value <<= 4U; + count += 4U; + } + + if ((value & 0xC0U) == 0xC0U) + { + value <<= 2U; + count += 2U; + } + + if ((value & 0x80U) == 0x80U) + { + value <<= 1U; + count += 1U; + } + + count -= ((value & 0x80U) == 0x0U); + } + + return count; +#endif + } + + inline ETL_CONSTEXPR14 uint_least8_t count_leading_ones(int8_t value) + { + return count_leading_ones(uint8_t(value)); + } +#endif + + //*************************************************************************** + /// Count leading ones. + /// Uses a binary search. + ///\ingroup binary + //*************************************************************************** + inline ETL_CONSTEXPR14 uint_least8_t count_leading_ones(uint16_t value) + { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::countl_one(value); +#else + uint_least8_t count = 0U; + + if ((value & 0x8000U) == 0U) + { + count = 0U; + } + else + { + count = 1U; + + if ((value & 0xFF00U) == 0xFF00U) + { + value <<= 8U; + count += 8U; + } + + if ((value & 0xF000U) == 0xF000U) + { + value <<= 4U; + count += 4U; + } + + if ((value & 0xC000U) == 0xC000U) + { + value <<= 2U; + count += 2U; + } + + if ((value & 0x8000U) == 0x8000U) + { + value <<= 1U; + count += 1U; + } + + count -= ((value & 0x8000U) == 0U); + } + + return count; +#endif + } + + inline ETL_CONSTEXPR14 uint_least8_t count_leading_ones(int16_t value) + { + return count_leading_ones(uint16_t(value)); + } + + //*************************************************************************** + /// Count leading ones. + /// Uses a binary search. + ///\ingroup binary + //*************************************************************************** + inline ETL_CONSTEXPR14 uint_least8_t count_leading_ones(uint32_t value) + { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::countl_one(value); +#else + uint_least8_t count = 0U; + + if ((value & 0x80000000UL) == 0UL) + { + count = 0U; + } + else + { + count = 1U; + + if ((value & 0xFFFF0000UL) == 0xFFFF0000UL) + { + value <<= 8U; + count += 8U; + } + + if ((value & 0xFF000000UL) == 0xFF000000UL) + { + value <<= 8U; + count += 8U; + } + + if ((value & 0xF0000000UL) == 0xF0000000UL) + { + value <<= 4U; + count += 4U; + } + + if ((value & 0xC0000000UL) == 0xC0000000UL) + { + value <<= 2U; + count += 2U; + } + + if ((value & 0x80000000UL) == 0x80000000UL) + { + value <<= 1U; + count += 1U; + } + + count -= ((value & 0x80000000UL) == 0UL); + } + + return count; +#endif + } + + inline ETL_CONSTEXPR14 uint_least8_t count_leading_ones(int32_t value) + { + return count_leading_ones(uint32_t(value)); + } + +#if ETL_USING_64BIT_TYPES + //*************************************************************************** + /// Count leading ones. + /// Uses a binary search. + ///\ingroup binary + //*************************************************************************** + inline ETL_CONSTEXPR14 uint_least8_t count_leading_ones(uint64_t value) + { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::countl_one(value); +#else + uint_least8_t count = 0U; + + if ((value & 0x8000000000000000ULL) == 0ULL) + { + count = 0U; + } + else + { + count = 1U; + + if ((value & 0xFFFFFFFF00000000ULL) == 0xFFFFFFFF00000000ULL) + { + value <<= 8U; + count += 8U; + } + + if ((value & 0xFFFF000000000000ULL) == 0xFFFF000000000000ULL) + { + value <<= 8U; + count += 8U; + } + + if ((value & 0xFF00000000000000ULL) == 0xFF00000000000000ULL) + { + value <<= 8U; + count += 8U; + } + + if ((value & 0xF000000000000000ULL) == 0xF000000000000000ULL) + { + value <<= 4U; + count += 4U; + } + + if ((value & 0xC000000000000000ULL) == 0xC000000000000000ULL) + { + value <<= 2U; + count += 2U; + } + + if ((value & 0x8000000000000000ULL) == 0x8000000000000000ULL) + { + value <<= 1U; + count += 1U; + } + + count -= ((value & 0x8000000000000000ULL) == 0ULL); + } + + return count; +#endif + } + + inline ETL_CONSTEXPR14 uint_least8_t count_leading_ones(int64_t value) + { + return count_leading_ones(uint64_t(value)); + } +#endif + #if ETL_8BIT_SUPPORT //***************************************************************************** /// Binary interleave diff --git a/include/etl/bit.h b/include/etl/bit.h new file mode 100644 index 00000000..844456d0 --- /dev/null +++ b/include/etl/bit.h @@ -0,0 +1,249 @@ +///\file + +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +https://www.etlcpp.com + +Copyright(c) 2021 jwellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ + +#ifndef ETL_BIT_INCLUDED +#define ETL_BIT_INCLUDED + +#include + +#include "platform.h" +#include "type_traits.h" +#include "binary.h" +#include "integral_limits.h" +#include "endianness.h" +#include "type_traits.h" + +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + #include +#endif + +namespace etl +{ + //*************************************************************************** + /// bit_cast + //*************************************************************************** + template + ETL_CONSTEXPR14 + typename etl::enable_if<(sizeof(TDestination) == sizeof(TSource)) && + etl::is_trivially_copyable::value && + etl::is_trivially_copyable::value, TDestination>::type + bit_cast(const TSource& source) ETL_NOEXCEPT + { + TDestination destination; + + const char* s = &source; + char* d = &destination; + char* const de = d + sizeof(TDestination); + + while (d != de) + { + *d++ = *s++; + } + + return destination; + } + + //*************************************************************************** + /// byteswap + //*************************************************************************** + template + ETL_CONSTEXPR14 + typename etl::enable_if::value, T>::type + byteswap(T value) ETL_NOEXCEPT + { + return etl::reverse_bytes(value); + } + + //*************************************************************************** + /// has_single_bit + //*************************************************************************** + template + ETL_NODISCARD ETL_CONSTEXPR14 + typename etl::enable_if::value, bool>::type has_single_bit(T value) ETL_NOEXCEPT + { + return (value & (value - 1)) == 0; + } + //*************************************************************************** + /// countl_zero + //*************************************************************************** + template + ETL_NODISCARD ETL_CONSTEXPR14 + typename etl::enable_if::value, int>::type + countl_zero(T value) ETL_NOEXCEPT + { + return etl::count_leading_zeros(value); + } + + //*************************************************************************** + /// countl_one + //*************************************************************************** + template + ETL_NODISCARD ETL_CONSTEXPR14 + typename etl::enable_if::value, int>::type + countl_one(T value) ETL_NOEXCEPT + { + return etl::count_leading_ones(value); + } + + //*************************************************************************** + /// countr_zero + //*************************************************************************** + template + ETL_NODISCARD ETL_CONSTEXPR14 + typename etl::enable_if::value, int>::type + countr_zero(T value) ETL_NOEXCEPT + { + return etl::count_trailing_zeros(value); + } + + //*************************************************************************** + /// countr_one + //*************************************************************************** + template + ETL_NODISCARD ETL_CONSTEXPR14 + typename etl::enable_if::value, int>::type + countr_one(T value) ETL_NOEXCEPT + { + return etl::count_trailing_ones(value);; + } + + + //*************************************************************************** + /// bit_width + //*************************************************************************** + template + ETL_CONSTEXPR14 + typename etl::enable_if::value, T>::type + bit_width(T value) ETL_NOEXCEPT + { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::bit_width(value); +#else + return etl::integral_limits::bits - etl::countl_zero(value); +#endif + } + + //*************************************************************************** + /// bit_ceil + //*************************************************************************** + template + ETL_NODISCARD ETL_CONSTEXPR14 + typename etl::enable_if::value, T>::type + bit_ceil(T value) + { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::bit_ceil(value); +#else + if (value == T(0)) + { + return T(1); + } + else + { + return T(1) << etl::bit_width(T(value - T(1))); + } +#endif + } + + //*************************************************************************** + /// bit_floor + //*************************************************************************** + template + ETL_NODISCARD ETL_CONSTEXPR14 + typename etl::enable_if::value, T>::type + bit_floor(T value) ETL_NOEXCEPT + { +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + return std::bit_floor(value); +#else + if (value == T(0)) + { + return T(0); + } + else + { + return T(1) << (etl::bit_width(value) - T(1)); + } +#endif + } + + //*************************************************************************** + /// rotl + //*************************************************************************** + template + ETL_NODISCARD ETL_CONSTEXPR14 + typename etl::enable_if::value, T>::type + rotl(T value, int n) ETL_NOEXCEPT + { + ETL_CONSTANT size_t N = etl::integral_limits::bits; + + if (n < 0) + { + return etl::rotate_right(value, -n); + } + else + { + return etl::rotate_left(value, n); + } + } + + //*************************************************************************** + /// rotr + //*************************************************************************** + template + ETL_NODISCARD ETL_CONSTEXPR14 + typename etl::enable_if::value, T>::type + rotr(T value, int n) ETL_NOEXCEPT + { + ETL_CONSTANT size_t N = etl::integral_limits::bits; + + if (n < 0) + { + return etl::rotate_left(value, -n); + } + else + { + return etl::rotate_right(value, n); + } + } + + //*************************************************************************** + /// popcount + //*************************************************************************** + template + ETL_NODISCARD ETL_CONSTEXPR14 + typename etl::enable_if::value, int>::type + popcount(T value) ETL_NOEXCEPT + { + return etl::count_bits(value); + } +} + +#endif diff --git a/include/etl/buffer_descriptors.h b/include/etl/buffer_descriptors.h index 4c58e407..d93d014e 100644 --- a/include/etl/buffer_descriptors.h +++ b/include/etl/buffer_descriptors.h @@ -196,11 +196,7 @@ namespace etl }; // The type of the callback function. -//#if ETL_CPP11_SUPPORTED & !defined(ETL_DELEGATE_FORCE_CPP03_IMPLEMENTATION) typedef etl::delegate callback_type; -//#else -// typedef etl::delegate callback_type; -//#endif //********************************* buffer_descriptors(TBuffer* pbuffers_, callback_type callback_ = callback_type()) diff --git a/include/etl/endianness.h b/include/etl/endianness.h index 4a18c9e5..f2c5479a 100644 --- a/include/etl/endianness.h +++ b/include/etl/endianness.h @@ -37,10 +37,46 @@ SOFTWARE. #include "enum_type.h" #include "binary.h" +#if ETL_CPP20_SUPPORTED && ETL_USING_STL + #include +#endif + ///\defgroup endian endian /// Constants & utilities for endianess ///\ingroup utilities +#if !((!defined(ETL_ENDIAN_LITTLE) && !defined(ETL_ENDIAN_BIG) && !defined(ETL_ENDIAN_NATIVE)) || ((defined(ETL_ENDIAN_LITTLE) && defined(ETL_ENDIAN_BIG) && defined(ETL_ENDIAN_NATIVE)))) + #error All three of ETL_ENDIAN_LITTLE, ETL_ENDIAN_BIG and ETL_ENDIAN_NATIVE must be defined +#endif + +// Have we not already defined all of the macros? +#if !defined(ETL_ENDIAN_LITTLE) || !defined(ETL_ENDIAN_BIG) || !defined(ETL_ENDIAN_NATIVE) + #undef ETL_ENDIAN_LITTLE + #undef ETL_ENDIAN_BIG + #undef ETL_ENDIAN_NATIVE + // Can we use the C++20 definitions? + #if ETL_CPP20_SUPPORTED && ETL_USING_STL + #define ETL_ENDIAN_LITTLE std::endian::little + #define ETL_ENDIAN_BIG std::endian::big + #define ETL_ENDIAN_NATIVE std::endian::native + // If not can we use the compiler macros? + #elif defined(__BYTE_ORDER__) + // Test the two versions of the macro we are likely to see. + #if defined(__ORDER_LITTLE_ENDIAN__) + #define ETL_ENDIAN_LITTLE __ORDER_LITTLE_ENDIAN__ + #define ETL_ENDIAN_BIG __ORDER_BIG_ENDIAN__ + #define ETL_ENDIAN_NATIVE __BYTE_ORDER__ + #elif defined(__LITTLE_ENDIAN__) + #define ETL_ENDIAN_LITTLE __LITTLE_ENDIAN__ + #define ETL_ENDIAN_BIG __BIG_ENDIAN__ + #define ETL_ENDIAN_NATIVE __BYTE_ORDER__ + #endif + #endif +#endif + +// If true, then the endianness of the platform can be constexpr. +#define ETL_ENDIANNESS_IS_CONSTEXPR (ETL_CPP11_SUPPORTED && defined(ETL_ENDIAN_NATIVE)) + namespace etl { //*************************************************************************** @@ -49,17 +85,28 @@ namespace etl //*************************************************************************** struct endian { +#if defined(ETL_ENDIAN_NATIVE) + enum enum_type + { + little = static_cast(ETL_ENDIAN_LITTLE), + big = static_cast(ETL_ENDIAN_BIG), + native = static_cast(ETL_ENDIAN_NATIVE), + unknown = INT_MAX + }; +#else enum enum_type { little, big, - native + native, + unknown = native }; +#endif ETL_DECLARE_ENUM_TYPE(endian, int) - ETL_ENUM_TYPE(little, "little") - ETL_ENUM_TYPE(big, "big") - ETL_ENUM_TYPE(native, "native") + ETL_ENUM_TYPE(little, "little") + ETL_ENUM_TYPE(big, "big") + ETL_ENUM_TYPE(unknown, "unknown") ETL_END_ENUM_TYPE }; @@ -74,11 +121,17 @@ namespace etl return etl::endian(*this); } +#if ETL_ENDIANNESS_IS_CONSTEXPR + ETL_CONSTEXPR +#endif operator etl::endian() const { return get(); } +#if ETL_ENDIANNESS_IS_CONSTEXPR + ETL_CONSTEXPR +#endif static etl::endian value() { return get(); @@ -86,38 +139,19 @@ namespace etl private: +#if ETL_ENDIANNESS_IS_CONSTEXPR + ETL_CONSTEXPR static etl::endian get() + { + return etl::endian::native; + } +#else static etl::endian get() { - static union U - { - U() - : ui32(0x12345678UL) - { - } + static const uint32_t i = 0xFFFF0000; - uint32_t ui32; - uint16_t ui16[2]; - } u; - - return (u.ui16[0] == 0x5678U) ? etl::endian::little : etl::endian::big; + return (*reinterpret_cast(&i) == 0) ? etl::endian::little : etl::endian::big; } - -// constexpr static auto check() -// { -//#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) -// -// return etl::endian::big; -// -//#elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) -// -// return etl::endian::little; -// -//#else -// -// return Endian::UNKNOWN; -// -//#endif -// } +#endif }; //*************************************************************************** diff --git a/include/etl/experimental/bit_cast.h b/include/etl/experimental/bit_cast.h index 0add8d5e..eefa3bbd 100644 --- a/include/etl/experimental/bit_cast.h +++ b/include/etl/experimental/bit_cast.h @@ -1,20 +1,33 @@ #pragma once -template -etl::enable_if_t && etl::is_trivially_copyable_v, To> -//ETL_CONSTEXPR -bit_cast(const From& src) ETL_NOEXCEPT +#include "platform.h" + +template +typename etl::enable_if<(sizeof(TDestination) == sizeof(TSource)) && + etl::is_trivially_copyable::value && + etl::is_trivially_copyable::value, TDestination>::type + bit_cast(const TSource& source) ETL_NOEXCEPT { - To dst; - memcpy(&dst, &src, sizeof(To)); + TDestination destination; - // __builtin_memcpy(&dst, &src, sizeof(To)); + memcpy(&destination, &source, sizeof(TDestination)); - return dst; + return destination; } -std::midpoint -// https://en.cppreference.com/w/cpp/numeric/midpoint +template +ETL_CONSTEXPR +typename etl::enable_if<(sizeof(TDestination) == sizeof(TSource)) && + etl::is_trivially_copyable::value && + etl::is_trivially_copyable::value, TDestination>::type + bit_cast(const TSource& source) ETL_NOEXCEPT +{ + TDestination destination; + + __builtin_memcpy(&destination, &source, sizeof(TDestination)); + + return destination; +} + + -std::lerp -// https://en.cppreference.com/w/cpp/numeric/lerp \ No newline at end of file diff --git a/include/etl/functional.h b/include/etl/functional.h index 1559161e..ce7300c2 100644 --- a/include/etl/functional.h +++ b/include/etl/functional.h @@ -106,9 +106,26 @@ namespace etl return reference_wrapper(t.get()); } + //*************************************************************************** + template + struct unary_function + { + typedef TArgumentType argument_type; + typedef TResultType result_type; + }; + + //*************************************************************************** + template + struct binary_function + { + typedef TFirstArgumentType first_argument_type; + typedef TSecondArgumentType second_argument_type; + typedef TResultType result_type; + }; + //*************************************************************************** template - struct less + struct less : public etl::binary_function { typedef T value_type; @@ -120,7 +137,7 @@ namespace etl #if ETL_CPP11_SUPPORTED template <> - struct less + struct less : public etl::binary_function { typedef int is_transparent; @@ -134,7 +151,7 @@ namespace etl //*************************************************************************** template - struct less_equal + struct less_equal : public etl::binary_function { typedef T value_type; @@ -144,10 +161,9 @@ namespace etl } }; - #if ETL_CPP11_SUPPORTED template <> - struct less_equal + struct less_equal : public etl::binary_function { typedef int is_transparent; @@ -161,7 +177,7 @@ namespace etl //*************************************************************************** template - struct greater + struct greater : public etl::binary_function { typedef T value_type; @@ -173,7 +189,7 @@ namespace etl #if ETL_CPP11_SUPPORTED template <> - struct greater + struct greater : public etl::binary_function { typedef int is_transparent; @@ -187,7 +203,7 @@ namespace etl //*************************************************************************** template - struct greater_equal + struct greater_equal : public etl::binary_function { typedef T value_type; @@ -199,7 +215,7 @@ namespace etl #if ETL_CPP11_SUPPORTED template <> - struct greater_equal + struct greater_equal : public etl::binary_function { typedef int is_transparent; @@ -213,7 +229,7 @@ namespace etl //*************************************************************************** template - struct equal_to + struct equal_to : public etl::binary_function { typedef T value_type; @@ -225,7 +241,7 @@ namespace etl #if ETL_CPP11_SUPPORTED template <> - struct equal_to + struct equal_to : public etl::binary_function { typedef void value_type; typedef int is_transparent; @@ -240,7 +256,7 @@ namespace etl //*************************************************************************** template - struct not_equal_to + struct not_equal_to : public etl::binary_function { typedef T value_type; @@ -252,7 +268,7 @@ namespace etl #if ETL_CPP11_SUPPORTED template <> - struct not_equal_to + struct not_equal_to : public etl::binary_function { typedef int is_transparent; @@ -265,26 +281,6 @@ namespace etl #endif //*************************************************************************** - - template - struct unary_function - { - typedef TArgumentType argument_type; - typedef TResultType result_type; - }; - - //*************************************************************************** - - template - struct binary_function - { - typedef TFirstArgumentType first_argument_type; - typedef TSecondArgumentType second_argument_type; - typedef TResultType result_type; - }; - - //*************************************************************************** - template class binder1st : public etl::unary_function { diff --git a/include/etl/iterator.h b/include/etl/iterator.h index 5fb8c080..4724bb47 100644 --- a/include/etl/iterator.h +++ b/include/etl/iterator.h @@ -51,10 +51,13 @@ namespace etl struct forward_iterator_tag : public input_iterator_tag {}; struct bidirectional_iterator_tag : public forward_iterator_tag {}; struct random_access_iterator_tag : public bidirectional_iterator_tag {}; + struct contiguous_iterator_tag : public random_access_iterator_tag {}; //*************************************************************************** // iterator_traits - template + + // For anything not a fundamental type. + template ::value, void>::type> struct iterator_traits { typedef typename TIterator::iterator_category iterator_category; @@ -63,25 +66,27 @@ namespace etl typedef typename TIterator::pointer pointer; typedef typename TIterator::reference reference; }; - + + // For pointers. template - struct iterator_traits + struct iterator_traits { typedef ETL_OR_STD::random_access_iterator_tag iterator_category; - typedef T value_type; - typedef ptrdiff_t difference_type; - typedef T* pointer; - typedef T& reference; + typedef T value_type; + typedef ptrdiff_t difference_type; + typedef typename etl::remove_cv::type* pointer; + typedef T& reference; }; + // For const pointers. template - struct iterator_traits + struct iterator_traits { - typedef ETL_OR_STD::random_access_iterator_tag iterator_category; - typedef T value_type; - typedef ptrdiff_t difference_type; - typedef const T* pointer; - typedef const T& reference; + typedef ETL_OR_STD::random_access_iterator_tag iterator_category; + typedef T value_type; + typedef ptrdiff_t difference_type; + typedef const typename etl::remove_cv::type* pointer; + typedef const T& reference; }; //*************************************************************************** diff --git a/include/etl/numeric.h b/include/etl/numeric.h index e30475bd..f274635c 100644 --- a/include/etl/numeric.h +++ b/include/etl/numeric.h @@ -32,6 +32,13 @@ SOFTWARE. #define ETL_NUMERIC_INCLUDED #include "platform.h" +#include "type_traits.h" +#include "limits.h" +#include "iterator.h" + +#if ETL_USING_STL + #include +#endif ///\defgroup numeric numeric ///\ingroup utilities @@ -54,7 +61,159 @@ namespace etl *first++ = value++; } } + + //*************************************************************************** + /// midpoint + /// For floating point. + //*************************************************************************** + template + ETL_CONSTEXPR14 typename etl::enable_if::value && + !etl::is_integral::value && + etl::is_floating_point::value, T>::type + midpoint(T a, T b) ETL_NOEXCEPT + { + T lo = etl::numeric_limits::min() * T(2); + T hi = etl::numeric_limits::max() * T(2); + + return ((abs(a) <= hi) && (abs(b) <= hi)) ? + (a + b) / T(2) : + (abs(a) < lo) ? + a + (b / T(2)) : + (abs(b) < lo) ? + ((a / T(2)) + b) : + (a / T(2)) + (b / T(2)); + } + + //*************************************************************************** + /// midpoint + /// For unsigned integrals. + //*************************************************************************** + template + ETL_CONSTEXPR14 typename etl::enable_if::value && + etl::is_integral::value && + !etl::is_floating_point::value && + etl::is_unsigned::value, T>::type + midpoint(T a, T b) ETL_NOEXCEPT + { + if (a > b) + { + return a - ((a - b) >> 1); + } + else + { + return a + ((b - a) >> 1); + } + } + + //*************************************************************************** + /// midpoint + /// For signed integrals. + //*************************************************************************** + template + ETL_CONSTEXPR14 typename etl::enable_if::value&& + etl::is_integral::value && + !etl::is_floating_point::value&& + etl::is_signed::value, T>::type + midpoint(T a, T b) ETL_NOEXCEPT + { + typedef typename etl::make_unsigned::type utype; + + if (a > b) + { + return a - T(utype(utype(a) - utype(b)) >> 1); + } + else + { + return a + T((utype(b) - utype(a)) >> 1); + } + } + + //*************************************************************************** + /// midpoint + /// For pointers. + //*************************************************************************** + template + ETL_CONSTEXPR typename etl::enable_if::value&& + !etl::is_integral::value && + !etl::is_floating_point::value, T>::type + midpoint(T a, T b) ETL_NOEXCEPT + { + if (a > b) + { + return b + (etl::distance(b, a) / 2U); + } + else + { + return a + (etl::distance(a, b) / 2U); + } + } + + //*************************************************************************** + /// midpoint + /// For ETL random access iterators. + //*************************************************************************** + template + ETL_CONSTEXPR T midpoint(T a, T b, typename etl::enable_if::value && + !etl::is_integral::value && + !etl::is_floating_point::value && + etl::is_same::iterator_category, ETL_OR_STD::random_access_iterator_tag>::value , int>::type = 0) + { + if (a > b) + { + return b + (etl::distance(b, a) / 2U); + } + else + { + return a + (etl::distance(a, b) / 2U); + } + } + + //*************************************************************************** + /// midpoint + /// For ETL forward and bidirectional iterators. + /// Parameter 'a' must be before 'b', otherwise the result is undefined. + //*************************************************************************** + template + ETL_CONSTEXPR T midpoint(T a, T b, typename etl::enable_if<(!etl::is_pointer::value && + !etl::is_integral::value && + !etl::is_floating_point::value && + etl::is_same::iterator_category, ETL_OR_STD::forward_iterator_tag>::value || + etl::is_same::iterator_category, ETL_OR_STD::bidirectional_iterator_tag>::value) + , int>::type = 0) + { + etl::advance(a, etl::distance(a, b) / 2U); + return a; + } + + //*************************************************************************** + /// Linear interpolation + /// For floating point. + //*************************************************************************** + template + ETL_CONSTEXPR typename etl::enable_if::value, T>::type + lerp(T a, T b, T t) ETL_NOEXCEPT + { + return a + (t * (b - a)); + } + + //*************************************************************************** + /// Linear interpolation + /// For when any parameter is not floating point. + //*************************************************************************** + template + ETL_CONSTEXPR typename etl::enable_if::value || + !etl::is_floating_point::value || + !etl::is_floating_point::value, typename etl::conditional::value || + etl::is_same::value || + etl::is_same::value, long double, double>::type>::type + lerp(TArithmetic1 a, TArithmetic2 b, TArithmetic3 t) ETL_NOEXCEPT + { + typedef typename etl::conditional::value, double, TArithmetic1>::type typecast_a; + typedef typename etl::conditional::value, double, TArithmetic2>::type typecast_b; + typedef typename etl::conditional::value, double, TArithmetic3>::type typecast_t; + + return typecast_a(a) + (typecast_t(t) * (typecast_b(b) - typecast_a(a))); + } } #endif - diff --git a/include/etl/private/minmax_pop.h b/include/etl/private/minmax_pop.h index e25d0a93..be65d9c1 100644 --- a/include/etl/private/minmax_pop.h +++ b/include/etl/private/minmax_pop.h @@ -32,11 +32,13 @@ SOFTWARE. * The header include guard has been intentionally omitted. * This file is intended to evaluated multiple times by design. */ -#if !defined(ETL_COMPILER_ARM5) && !defined(ETL_COMPILER_GREEN_HILLS) - #pragma pop_macro("min") - #pragma pop_macro("max") -#else - #define min(a,b) ((a)<(b)?(a):(b)) - #define max(a,b) ((a)<(b)?(b):(a)) +#if !defined(ETL_COMPILER_GREEN_HILLS) + #if !defined(ETL_COMPILER_ARM5) + #pragma pop_macro("min") + #pragma pop_macro("max") + #else + #define min(a,b) ((a)<(b)?(a):(b)) + #define max(a,b) ((a)<(b)?(b):(a)) + #endif #endif diff --git a/include/etl/private/minmax_push.h b/include/etl/private/minmax_push.h index ef71439c..75dc34a4 100644 --- a/include/etl/private/minmax_push.h +++ b/include/etl/private/minmax_push.h @@ -32,10 +32,13 @@ SOFTWARE. * The header include guard has been intentionally omitted. * This file is intended to evaluated multiple times by design. */ -#if !defined(ETL_COMPILER_ARM5) && !defined(ETL_COMPILER_GREEN_HILLS) - #pragma push_macro("min") - #pragma push_macro("max") -#endif -#undef min -#undef max +#if !defined(ETL_COMPILER_GREEN_HILLS) + #if !defined(ETL_COMPILER_ARM5) + #pragma push_macro("min") + #pragma push_macro("max") + #endif + + #undef min + #undef max +#endif diff --git a/include/etl/profiles/determine_compiler_language_support.h b/include/etl/profiles/determine_compiler_language_support.h index f2cbe9b1..25e61ad0 100644 --- a/include/etl/profiles/determine_compiler_language_support.h +++ b/include/etl/profiles/determine_compiler_language_support.h @@ -35,29 +35,78 @@ SOFTWARE. #include "determine_compiler.h" -#if !defined(ETL_CPP11_SUPPORTED) && !defined(ETL_CPP14_SUPPORTED) && !defined(ETL_CPP17_SUPPORTED) +// Determine C++20 support +#if !defined(ETL_CPP20_SUPPORTED) +#if defined(__cplusplus) +#if defined(ETL_COMPILER_MICROSOFT) +#define ETL_CPP20_SUPPORTED (_MSC_VER >= 1929) +#elif defined(ETL_COMPILER_ARM5) +#define ETL_CPP20_SUPPORTED 0 +#else +#define ETL_CPP20_SUPPORTED (__cplusplus >= 202002L) +#endif +#else +#define ETL_CPP20_SUPPORTED 0 +#endif +#endif + +#if ETL_CPP20_SUPPORTED + #define ETL_CPP11_SUPPORTED 1 + #define ETL_CPP14_SUPPORTED 1 + #define ETL_CPP17_SUPPORTED 1 +#endif + +// Determine C++17 support +#if !defined(ETL_CPP17_SUPPORTED) + #if defined(__cplusplus) + #if defined(ETL_COMPILER_MICROSOFT) + #define ETL_CPP17_SUPPORTED (_MSC_VER >= 1914) + #elif defined(ETL_COMPILER_ARM5) + #define ETL_CPP17_SUPPORTED 0 + #else + #define ETL_CPP17_SUPPORTED (__cplusplus >= 201703L) + #endif + #else + #define ETL_CPP17_SUPPORTED 0 + #endif +#endif + +#if ETL_CPP17_SUPPORTED + #define ETL_CPP11_SUPPORTED 1 + #define ETL_CPP14_SUPPORTED 1 +#endif + +// Determine C++14 support +#if !defined(ETL_CPP14_SUPPORTED) + #if defined(__cplusplus) + #if defined(ETL_COMPILER_MICROSOFT) + #define ETL_CPP14_SUPPORTED (_MSC_VER >= 1900) + #elif defined(ETL_COMPILER_ARM5) + #define ETL_CPP14_SUPPORTED 0 + #else + #define ETL_CPP14_SUPPORTED (__cplusplus >= 201402L) + #endif + #else + #define ETL_CPP14_SUPPORTED 0 + #endif +#endif + +#if ETL_CPP14_SUPPORTED + #define ETL_CPP11_SUPPORTED 1 +#endif + +// Determine C++11 support +#if !defined(ETL_CPP11_SUPPORTED) #if defined(__cplusplus) #if defined(ETL_COMPILER_MICROSOFT) #define ETL_CPP11_SUPPORTED (_MSC_VER >= 1600) - #define ETL_CPP14_SUPPORTED (_MSC_VER >= 1900) - #define ETL_CPP17_SUPPORTED (_MSC_VER >= 1914) - #define ETL_CPP20_SUPPORTED 0 #elif defined(ETL_COMPILER_ARM5) #define ETL_CPP11_SUPPORTED 0 - #define ETL_CPP14_SUPPORTED 0 - #define ETL_CPP17_SUPPORTED 0 - #define ETL_CPP20_SUPPORTED 0 #else #define ETL_CPP11_SUPPORTED (__cplusplus >= 201103L) - #define ETL_CPP14_SUPPORTED (__cplusplus >= 201402L) - #define ETL_CPP17_SUPPORTED (__cplusplus >= 201703L) - #define ETL_CPP20_SUPPORTED 0 #endif #else #define ETL_CPP11_SUPPORTED 0 - #define ETL_CPP14_SUPPORTED 0 - #define ETL_CPP17_SUPPORTED 0 - #define ETL_CPP20_SUPPORTED 0 #endif #endif @@ -65,6 +114,7 @@ SOFTWARE. #define ETL_CPP11_NOT_SUPPORTED !ETL_CPP11_SUPPORTED #define ETL_CPP14_NOT_SUPPORTED !ETL_CPP14_SUPPORTED #define ETL_CPP17_NOT_SUPPORTED !ETL_CPP17_SUPPORTED +#define ETL_CPP20_NOT_SUPPORTED !ETL_CPP20_SUPPORTED #if !defined(ETL_NO_NULLPTR_SUPPORT) #define ETL_NO_NULLPTR_SUPPORT ETL_CPP11_NOT_SUPPORTED diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 43b9c5f3..f8a755c8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -48,6 +48,7 @@ set(TEST_SOURCE_FILES test_atomic_std.cpp test_binary.cpp test_bip_buffer_spsc_atomic.cpp + test_bit.cpp test_bitset.cpp test_bit_stream.cpp test_byte_stream.cpp @@ -254,6 +255,7 @@ set(TEST_SOURCE_FILES test_type_lookup.cpp test_type_select.cpp test_type_traits.cpp +# test_unaligned_type.cpp test_unordered_map.cpp test_unordered_multimap.cpp test_unordered_multiset.cpp diff --git a/test/etl_profile.h b/test/etl_profile.h index 2ef4c5f1..bde20732 100644 --- a/test/etl_profile.h +++ b/test/etl_profile.h @@ -73,6 +73,12 @@ SOFTWARE. #define ETL_POLYMORPHIC_VECTOR #define ETL_POLYMORPHIC_INDIRECT_VECTOR +#if defined(ETL_CPP20_ENABLED) + #define ETL_CPP20_SUPPORTED 1 +#else + #define ETL_CPP20_SUPPORTED 0 +#endif + //#define ETL_POLYMORPHIC_CONTAINERS //#define ETL_MESSAGES_ARE_VIRTUAL diff --git a/test/sanity-check/bit.h.t.cpp b/test/sanity-check/bit.h.t.cpp new file mode 100644 index 00000000..74493814 --- /dev/null +++ b/test/sanity-check/bit.h.t.cpp @@ -0,0 +1,29 @@ +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +https://www.etlcpp.com + +Copyright(c) 2022 John Wellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ + +#include diff --git a/test/sanity-check/c++03/CMakeLists.txt b/test/sanity-check/c++03/CMakeLists.txt index 66e5ec06..9f761199 100644 --- a/test/sanity-check/c++03/CMakeLists.txt +++ b/test/sanity-check/c++03/CMakeLists.txt @@ -49,6 +49,7 @@ target_sources(t98 PRIVATE etl_profile.h ../basic_string_stream.h.t.cpp ../binary.h.t.cpp ../bip_buffer_spsc_atomic.h.t.cpp + ../bit.h.t.cpp ../bitset.h.t.cpp ../bit_stream.h.t.cpp ../byte_stream.h.t.cpp @@ -258,6 +259,7 @@ target_sources(t98 PRIVATE etl_profile.h ../u32format_spec.h.t.cpp ../u32string.h.t.cpp ../u32string_stream.h.t.cpp + #../unaligned_type.h.t.cpp ../unordered_map.h.t.cpp ../unordered_multimap.h.t.cpp ../unordered_multiset.h.t.cpp diff --git a/test/sanity-check/c++03/etl_profile.h b/test/sanity-check/c++03/etl_profile.h index a16d2298..683af364 100644 --- a/test/sanity-check/c++03/etl_profile.h +++ b/test/sanity-check/c++03/etl_profile.h @@ -34,6 +34,7 @@ SOFTWARE. #define ETL_CPP11_SUPPORTED 0 #define ETL_CPP14_SUPPORTED 0 #define ETL_CPP17_SUPPORTED 0 +#define ETL_CPP20_SUPPORTED 0 #define ETL_IN_UNIT_TEST #define ETL_CALLBACK_TIMER_USE_INTERRUPT_LOCK #define ETL_CALLBACK_TIMER_DISABLE_INTERRUPTS diff --git a/test/sanity-check/c++11/CMakeLists.txt b/test/sanity-check/c++11/CMakeLists.txt index a914b437..19c7a565 100644 --- a/test/sanity-check/c++11/CMakeLists.txt +++ b/test/sanity-check/c++11/CMakeLists.txt @@ -49,6 +49,7 @@ target_sources(t11 PRIVATE etl_profile.h ../basic_string_stream.h.t.cpp ../binary.h.t.cpp ../bip_buffer_spsc_atomic.h.t.cpp + ../bit.h.t.cpp ../bitset.h.t.cpp ../bit_stream.h.t.cpp ../byte_stream.h.t.cpp @@ -258,6 +259,7 @@ target_sources(t11 PRIVATE etl_profile.h ../u32format_spec.h.t.cpp ../u32string.h.t.cpp ../u32string_stream.h.t.cpp + #../unaligned_type.h.t.cpp ../unordered_map.h.t.cpp ../unordered_multimap.h.t.cpp ../unordered_multiset.h.t.cpp diff --git a/test/sanity-check/c++11/etl_profile.h b/test/sanity-check/c++11/etl_profile.h index 54a6f1e1..729ddaa2 100644 --- a/test/sanity-check/c++11/etl_profile.h +++ b/test/sanity-check/c++11/etl_profile.h @@ -34,6 +34,7 @@ SOFTWARE. #define ETL_CPP11_SUPPORTED 1 #define ETL_CPP14_SUPPORTED 0 #define ETL_CPP17_SUPPORTED 0 +#define ETL_CPP20_SUPPORTED 0 #define ETL_IN_UNIT_TEST #define ETL_CALLBACK_TIMER_USE_INTERRUPT_LOCK #define ETL_CALLBACK_TIMER_DISABLE_INTERRUPTS diff --git a/test/sanity-check/c++14/CMakeLists.txt b/test/sanity-check/c++14/CMakeLists.txt index 0fba265c..35131435 100644 --- a/test/sanity-check/c++14/CMakeLists.txt +++ b/test/sanity-check/c++14/CMakeLists.txt @@ -49,6 +49,7 @@ target_sources(t14 PRIVATE etl_profile.h ../basic_string_stream.h.t.cpp ../binary.h.t.cpp ../bip_buffer_spsc_atomic.h.t.cpp + ../bit.h.t.cpp ../bitset.h.t.cpp ../bit_stream.h.t.cpp ../byte_stream.h.t.cpp @@ -258,6 +259,7 @@ target_sources(t14 PRIVATE etl_profile.h ../u32format_spec.h.t.cpp ../u32string.h.t.cpp ../u32string_stream.h.t.cpp + #../unaligned_type.h.t.cpp ../unordered_map.h.t.cpp ../unordered_multimap.h.t.cpp ../unordered_multiset.h.t.cpp diff --git a/test/sanity-check/c++14/etl_profile.h b/test/sanity-check/c++14/etl_profile.h index 652b501c..51205160 100644 --- a/test/sanity-check/c++14/etl_profile.h +++ b/test/sanity-check/c++14/etl_profile.h @@ -34,6 +34,7 @@ SOFTWARE. #define ETL_CPP11_SUPPORTED 1 #define ETL_CPP14_SUPPORTED 1 #define ETL_CPP17_SUPPORTED 0 +#define ETL_CPP20_SUPPORTED 0 #define ETL_IN_UNIT_TEST #define ETL_CALLBACK_TIMER_USE_INTERRUPT_LOCK #define ETL_CALLBACK_TIMER_DISABLE_INTERRUPTS diff --git a/test/sanity-check/c++17/CMakeLists.txt b/test/sanity-check/c++17/CMakeLists.txt index eb0b4679..77f3f6e6 100644 --- a/test/sanity-check/c++17/CMakeLists.txt +++ b/test/sanity-check/c++17/CMakeLists.txt @@ -49,6 +49,7 @@ target_sources(t17 PRIVATE etl_profile.h ../basic_string_stream.h.t.cpp ../binary.h.t.cpp ../bip_buffer_spsc_atomic.h.t.cpp + ../bit.h.t.cpp ../bitset.h.t.cpp ../bit_stream.h.t.cpp ../byte_stream.h.t.cpp @@ -258,6 +259,7 @@ target_sources(t17 PRIVATE etl_profile.h ../u32format_spec.h.t.cpp ../u32string.h.t.cpp ../u32string_stream.h.t.cpp + #../unaligned_type.h.t.cpp ../unordered_map.h.t.cpp ../unordered_multimap.h.t.cpp ../unordered_multiset.h.t.cpp diff --git a/test/sanity-check/c++17/etl_profile.h b/test/sanity-check/c++17/etl_profile.h index cc9973f1..624065dc 100644 --- a/test/sanity-check/c++17/etl_profile.h +++ b/test/sanity-check/c++17/etl_profile.h @@ -34,6 +34,7 @@ SOFTWARE. #define ETL_CPP11_SUPPORTED 1 #define ETL_CPP14_SUPPORTED 1 #define ETL_CPP17_SUPPORTED 1 +#define ETL_CPP20_SUPPORTED 0 #define ETL_IN_UNIT_TEST #define ETL_CALLBACK_TIMER_USE_INTERRUPT_LOCK #define ETL_CALLBACK_TIMER_DISABLE_INTERRUPTS diff --git a/test/sanity-check/unaligned_type.h.t.cpp b/test/sanity-check/unaligned_type.h.t.cpp new file mode 100644 index 00000000..841f0d81 --- /dev/null +++ b/test/sanity-check/unaligned_type.h.t.cpp @@ -0,0 +1,29 @@ +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +https://www.etlcpp.com + +Copyright(c) 2022 John Wellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ + +#include diff --git a/test/test_algorithm.cpp b/test/test_algorithm.cpp index 8c30281a..604feca0 100644 --- a/test/test_algorithm.cpp +++ b/test/test_algorithm.cpp @@ -1203,10 +1203,10 @@ namespace is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation)); CHECK(!is_permutation); - is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation), std::equal_to()); + is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation), etl::equal_to()); CHECK(is_permutation); - is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation), std::equal_to()); + is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation), etl::equal_to()); CHECK(!is_permutation); is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation), std::end(permutation)); @@ -1215,10 +1215,10 @@ namespace is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation), std::end(not_permutation)); CHECK(!is_permutation); - is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation), std::end(permutation), std::equal_to()); + is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(permutation), std::end(permutation), etl::equal_to()); CHECK(is_permutation); - is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation), std::end(not_permutation), std::equal_to()); + is_permutation = etl::is_permutation(std::begin(data1), std::end(data1), std::begin(not_permutation), std::end(not_permutation), etl::equal_to()); CHECK(!is_permutation); } diff --git a/test/test_binary.cpp b/test/test_binary.cpp index d545684a..4741f46a 100644 --- a/test/test_binary.cpp +++ b/test/test_binary.cpp @@ -40,6 +40,7 @@ SOFTWARE. namespace { + //*********************************** // Count bits the easy way. template size_t test_count(T value) @@ -57,6 +58,73 @@ namespace return count; } + //*********************************** + // Count trailing zeros the long way. + template + size_t test_trailing_zeros(T value) + { + size_t count = 0UL; + + for (int i = 0; i < etl::integral_limits::bits; ++i) + { + if ((value & 1) == 0) + { + ++count; + } + else + { + return count; + } + + value >>= 1; + } + + return count; + } + + //*********************************** + // Count leading zeros the long way. + template + size_t test_leading_zeros(T value) + { + value = etl::reverse_bits(value); + return test_trailing_zeros(value); + } + + //*********************************** + // Count trailing ones the long way. + template + size_t test_trailing_ones(T value) + { + size_t count = 0UL; + + for (int i = 0; i < etl::integral_limits::bits; ++i) + { + if ((value & 1) == 1) + { + ++count; + } + else + { + return count; + } + + value >>= 1; + } + + return count; + } + + //*********************************** + // Count leading ones the long way. + template + size_t test_leading_ones(T value) + { + value = etl::reverse_bits(value); + return test_trailing_ones(value); + } + + //*********************************** // Check parity the easy way. template size_t test_parity(T value) @@ -66,6 +134,7 @@ namespace return count & 1; } + //*********************************** // Power of 2. uint64_t test_power_of_2(int power) { @@ -79,6 +148,7 @@ namespace return result; } + //*********************************** // Fold bits. template TReturn test_fold_bits(uint64_t value, int size) @@ -99,6 +169,7 @@ namespace return result; } + //*********************************** // Slow gray to binary template T compare_gray_to_binary(T value_) @@ -740,7 +811,7 @@ namespace //************************************************************************* TEST(test_binary_to_gray32) { - etl::fnv_1a_32 hash; + etl::fnv_1_32 hash; hash.add(1); @@ -1162,139 +1233,143 @@ namespace //************************************************************************* TEST(test_max_value_for_bits) { - // Check that the values are correct. - //CHECK_EQUAL(0U, etl::max_value_for_nbits<0>::value); - CHECK_EQUAL(1U, etl::max_value_for_nbits<1>::value); - CHECK_EQUAL(3U, etl::max_value_for_nbits<2>::value); - CHECK_EQUAL(7U, etl::max_value_for_nbits<3>::value); - CHECK_EQUAL(15U, etl::max_value_for_nbits<4>::value); - CHECK_EQUAL(31U, etl::max_value_for_nbits<5>::value); - CHECK_EQUAL(63U, etl::max_value_for_nbits<6>::value); - CHECK_EQUAL(127U, etl::max_value_for_nbits<7>::value); - CHECK_EQUAL(255U, etl::max_value_for_nbits<8>::value); - CHECK_EQUAL(511U, etl::max_value_for_nbits<9>::value); - CHECK_EQUAL(1023U, etl::max_value_for_nbits<10>::value); - CHECK_EQUAL(2047U, etl::max_value_for_nbits<11>::value); - CHECK_EQUAL(4095U, etl::max_value_for_nbits<12>::value); - CHECK_EQUAL(8191U, etl::max_value_for_nbits<13>::value); - CHECK_EQUAL(16383U, etl::max_value_for_nbits<14>::value); - CHECK_EQUAL(32767U, etl::max_value_for_nbits<15>::value); - CHECK_EQUAL(65535U, etl::max_value_for_nbits<16>::value); - CHECK_EQUAL(131071UL, etl::max_value_for_nbits<17>::value); - CHECK_EQUAL(262143UL, etl::max_value_for_nbits<18>::value); - CHECK_EQUAL(524287UL, etl::max_value_for_nbits<19>::value); - CHECK_EQUAL(1048575UL, etl::max_value_for_nbits<20>::value); - CHECK_EQUAL(2097151UL, etl::max_value_for_nbits<21>::value); - CHECK_EQUAL(4194303UL, etl::max_value_for_nbits<22>::value); - CHECK_EQUAL(8388607UL, etl::max_value_for_nbits<23>::value); - CHECK_EQUAL(16777215UL, etl::max_value_for_nbits<24>::value); - CHECK_EQUAL(33554431UL, etl::max_value_for_nbits<25>::value); - CHECK_EQUAL(67108863UL, etl::max_value_for_nbits<26>::value); - CHECK_EQUAL(134217727UL, etl::max_value_for_nbits<27>::value); - CHECK_EQUAL(268435455UL, etl::max_value_for_nbits<28>::value); - CHECK_EQUAL(536870911UL, etl::max_value_for_nbits<29>::value); - CHECK_EQUAL(1073741823UL, etl::max_value_for_nbits<30>::value); - CHECK_EQUAL(2147483647UL, etl::max_value_for_nbits<31>::value); - CHECK_EQUAL(4294967295UL, etl::max_value_for_nbits<32>::value); - CHECK_EQUAL(8589934591ULL, etl::max_value_for_nbits<33>::value); - CHECK_EQUAL(17179869183ULL, etl::max_value_for_nbits<34>::value); - CHECK_EQUAL(34359738367ULL, etl::max_value_for_nbits<35>::value); - CHECK_EQUAL(68719476735ULL, etl::max_value_for_nbits<36>::value); - CHECK_EQUAL(137438953471ULL, etl::max_value_for_nbits<37>::value); - CHECK_EQUAL(274877906943ULL, etl::max_value_for_nbits<38>::value); - CHECK_EQUAL(549755813887ULL, etl::max_value_for_nbits<39>::value); - CHECK_EQUAL(1099511627775ULL, etl::max_value_for_nbits<40>::value); - CHECK_EQUAL(2199023255551ULL, etl::max_value_for_nbits<41>::value); - CHECK_EQUAL(4398046511103ULL, etl::max_value_for_nbits<42>::value); - CHECK_EQUAL(8796093022207ULL, etl::max_value_for_nbits<43>::value); - CHECK_EQUAL(17592186044415ULL, etl::max_value_for_nbits<44>::value); - CHECK_EQUAL(35184372088831ULL, etl::max_value_for_nbits<45>::value); - CHECK_EQUAL(70368744177663ULL, etl::max_value_for_nbits<46>::value); - CHECK_EQUAL(140737488355327ULL, etl::max_value_for_nbits<47>::value); - CHECK_EQUAL(281474976710655ULL, etl::max_value_for_nbits<48>::value); - CHECK_EQUAL(562949953421311ULL, etl::max_value_for_nbits<49>::value); - CHECK_EQUAL(1125899906842623ULL, etl::max_value_for_nbits<50>::value); - CHECK_EQUAL(2251799813685247ULL, etl::max_value_for_nbits<51>::value); - CHECK_EQUAL(4503599627370495ULL, etl::max_value_for_nbits<52>::value); - CHECK_EQUAL(9007199254740991ULL, etl::max_value_for_nbits<53>::value); - CHECK_EQUAL(18014398509481983ULL, etl::max_value_for_nbits<54>::value); - CHECK_EQUAL(36028797018963967ULL, etl::max_value_for_nbits<55>::value); - CHECK_EQUAL(72057594037927935ULL, etl::max_value_for_nbits<56>::value); - CHECK_EQUAL(144115188075855871ULL, etl::max_value_for_nbits<57>::value); - CHECK_EQUAL(288230376151711743ULL, etl::max_value_for_nbits<58>::value); - CHECK_EQUAL(576460752303423487ULL, etl::max_value_for_nbits<59>::value); - CHECK_EQUAL(1152921504606846975ULL, etl::max_value_for_nbits<60>::value); - CHECK_EQUAL(2305843009213693951ULL, etl::max_value_for_nbits<61>::value); - CHECK_EQUAL(4611686018427387903ULL, etl::max_value_for_nbits<62>::value); - CHECK_EQUAL(9223372036854775807ULL, etl::max_value_for_nbits<63>::value); - CHECK_EQUAL(18446744073709551615ULL, etl::max_value_for_nbits<64>::value); + // Check that the values are correct. + //CHECK_EQUAL(0U, etl::max_value_for_nbits<0>::value); + CHECK_EQUAL(1U, etl::max_value_for_nbits<1>::value); + CHECK_EQUAL(3U, etl::max_value_for_nbits<2>::value); + CHECK_EQUAL(7U, etl::max_value_for_nbits<3>::value); + CHECK_EQUAL(15U, etl::max_value_for_nbits<4>::value); + CHECK_EQUAL(31U, etl::max_value_for_nbits<5>::value); + CHECK_EQUAL(63U, etl::max_value_for_nbits<6>::value); + CHECK_EQUAL(127U, etl::max_value_for_nbits<7>::value); + CHECK_EQUAL(255U, etl::max_value_for_nbits<8>::value); + CHECK_EQUAL(511U, etl::max_value_for_nbits<9>::value); + CHECK_EQUAL(1023U, etl::max_value_for_nbits<10>::value); + CHECK_EQUAL(2047U, etl::max_value_for_nbits<11>::value); + CHECK_EQUAL(4095U, etl::max_value_for_nbits<12>::value); + CHECK_EQUAL(8191U, etl::max_value_for_nbits<13>::value); + CHECK_EQUAL(16383U, etl::max_value_for_nbits<14>::value); + CHECK_EQUAL(32767U, etl::max_value_for_nbits<15>::value); + CHECK_EQUAL(65535U, etl::max_value_for_nbits<16>::value); + CHECK_EQUAL(131071UL, etl::max_value_for_nbits<17>::value); + CHECK_EQUAL(262143UL, etl::max_value_for_nbits<18>::value); + CHECK_EQUAL(524287UL, etl::max_value_for_nbits<19>::value); + CHECK_EQUAL(1048575UL, etl::max_value_for_nbits<20>::value); + CHECK_EQUAL(2097151UL, etl::max_value_for_nbits<21>::value); + CHECK_EQUAL(4194303UL, etl::max_value_for_nbits<22>::value); + CHECK_EQUAL(8388607UL, etl::max_value_for_nbits<23>::value); + CHECK_EQUAL(16777215UL, etl::max_value_for_nbits<24>::value); + CHECK_EQUAL(33554431UL, etl::max_value_for_nbits<25>::value); + CHECK_EQUAL(67108863UL, etl::max_value_for_nbits<26>::value); + CHECK_EQUAL(134217727UL, etl::max_value_for_nbits<27>::value); + CHECK_EQUAL(268435455UL, etl::max_value_for_nbits<28>::value); + CHECK_EQUAL(536870911UL, etl::max_value_for_nbits<29>::value); + CHECK_EQUAL(1073741823UL, etl::max_value_for_nbits<30>::value); + CHECK_EQUAL(2147483647UL, etl::max_value_for_nbits<31>::value); + CHECK_EQUAL(4294967295UL, etl::max_value_for_nbits<32>::value); + CHECK_EQUAL(8589934591ULL, etl::max_value_for_nbits<33>::value); + CHECK_EQUAL(17179869183ULL, etl::max_value_for_nbits<34>::value); + CHECK_EQUAL(34359738367ULL, etl::max_value_for_nbits<35>::value); + CHECK_EQUAL(68719476735ULL, etl::max_value_for_nbits<36>::value); + CHECK_EQUAL(137438953471ULL, etl::max_value_for_nbits<37>::value); + CHECK_EQUAL(274877906943ULL, etl::max_value_for_nbits<38>::value); + CHECK_EQUAL(549755813887ULL, etl::max_value_for_nbits<39>::value); + CHECK_EQUAL(1099511627775ULL, etl::max_value_for_nbits<40>::value); + CHECK_EQUAL(2199023255551ULL, etl::max_value_for_nbits<41>::value); + CHECK_EQUAL(4398046511103ULL, etl::max_value_for_nbits<42>::value); + CHECK_EQUAL(8796093022207ULL, etl::max_value_for_nbits<43>::value); + CHECK_EQUAL(17592186044415ULL, etl::max_value_for_nbits<44>::value); + CHECK_EQUAL(35184372088831ULL, etl::max_value_for_nbits<45>::value); + CHECK_EQUAL(70368744177663ULL, etl::max_value_for_nbits<46>::value); + CHECK_EQUAL(140737488355327ULL, etl::max_value_for_nbits<47>::value); + CHECK_EQUAL(281474976710655ULL, etl::max_value_for_nbits<48>::value); + CHECK_EQUAL(562949953421311ULL, etl::max_value_for_nbits<49>::value); + CHECK_EQUAL(1125899906842623ULL, etl::max_value_for_nbits<50>::value); + CHECK_EQUAL(2251799813685247ULL, etl::max_value_for_nbits<51>::value); + CHECK_EQUAL(4503599627370495ULL, etl::max_value_for_nbits<52>::value); + CHECK_EQUAL(9007199254740991ULL, etl::max_value_for_nbits<53>::value); + CHECK_EQUAL(18014398509481983ULL, etl::max_value_for_nbits<54>::value); + CHECK_EQUAL(36028797018963967ULL, etl::max_value_for_nbits<55>::value); + CHECK_EQUAL(72057594037927935ULL, etl::max_value_for_nbits<56>::value); + CHECK_EQUAL(144115188075855871ULL, etl::max_value_for_nbits<57>::value); + CHECK_EQUAL(288230376151711743ULL, etl::max_value_for_nbits<58>::value); + CHECK_EQUAL(576460752303423487ULL, etl::max_value_for_nbits<59>::value); + CHECK_EQUAL(1152921504606846975ULL, etl::max_value_for_nbits<60>::value); + CHECK_EQUAL(2305843009213693951ULL, etl::max_value_for_nbits<61>::value); + CHECK_EQUAL(4611686018427387903ULL, etl::max_value_for_nbits<62>::value); + CHECK_EQUAL(9223372036854775807ULL, etl::max_value_for_nbits<63>::value); + CHECK_EQUAL(18446744073709551615ULL, etl::max_value_for_nbits<64>::value); + } - // Check that the value types are correct. - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); - CHECK((etl::is_same::value_type>::value)); + //************************************************************************* + TEST(test_max_value_for_bits_types) + { + // Check that the value types are correct. + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); + CHECK((etl::is_same::value_type>::value)); } //************************************************************************* @@ -1822,6 +1897,453 @@ namespace CHECK(!etl::is_even(1)); CHECK(etl::is_even(2)); } + + //************************************************************************* + TEST(test_count_trailing_zeros_8) + { + for (size_t i = 0; i < 256; ++i) + { + uint8_t value = uint8_t(i); + + CHECK_EQUAL(int(test_trailing_zeros(value)), int(etl::count_trailing_zeros(value))); + + if (test_trailing_zeros(value) != etl::count_trailing_zeros(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_count_trailing_zeros_8_constexpr) + { + char temp[etl::count_trailing_zeros(uint8_t(0x08))]; + + CHECK_EQUAL(test_trailing_zeros(uint8_t(0x08)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_count_trailing_zeros_16) + { + for (size_t i = 0; i < 65536; ++i) + { + uint16_t value = uint16_t(i); + + CHECK_EQUAL(test_trailing_zeros(value), etl::count_trailing_zeros(value)); + + if (test_trailing_zeros(value) != etl::count_trailing_zeros(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_count_trailing_zeros_16_constexpr) + { + char temp[etl::count_trailing_zeros(uint16_t(0x08))]; + + CHECK_EQUAL(test_trailing_zeros(uint16_t(0x08)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_count_trailing_zeros_32) + { + etl::fnv_1a_32 hash; + + for (size_t i = 0UL; i < 100000UL; ++i) + { + hash.add(1); + + uint32_t value = hash.value(); + + CHECK_EQUAL(test_trailing_zeros(value), etl::count_trailing_zeros(value)); + + if (test_trailing_zeros(value) != etl::count_trailing_zeros(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_count_trailing_zeros_32_constexpr) + { + char temp[etl::count_trailing_zeros(uint32_t(0x08))]; + + CHECK_EQUAL(test_trailing_zeros(uint32_t(0x08)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_count_trailing_zeros_64) + { + etl::fnv_1a_64 hash; + + for (size_t i = 0UL; i < 100000UL; ++i) + { + hash.add(1); + + uint64_t value = hash.value(); + + CHECK_EQUAL(test_trailing_zeros(value), etl::count_trailing_zeros(value)); + + if (test_trailing_zeros(value) != etl::count_trailing_zeros(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_count_trailing_zeros_64_constexpr) + { + char temp[etl::count_trailing_zeros(uint64_t(0x08))]; + + CHECK_EQUAL(etl::count_trailing_zeros(uint64_t(0x08)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_count_trailing_ones_8) + { + for (size_t i = 0; i < 256; ++i) + { + uint8_t value = uint8_t(i); + + CHECK_EQUAL(int(test_trailing_ones(value)), int(etl::count_trailing_ones(value))); + + if (test_trailing_ones(value) != etl::count_trailing_ones(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_count_trailing_ones_8_constexpr) + { + char temp[etl::count_trailing_ones(uint8_t(0x0F))]; + + CHECK_EQUAL(test_trailing_ones(uint8_t(0x0F)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_count_trailing_ones_16) + { + for (size_t i = 0; i < 65536; ++i) + { + uint16_t value = uint16_t(i); + + CHECK_EQUAL(int(test_trailing_ones(value)), int(etl::count_trailing_ones(value))); + + if (test_trailing_ones(value) != etl::count_trailing_ones(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_count_trailing_ones_16_constexpr) + { + char temp[etl::count_trailing_ones(uint16_t(0x000F))]; + + CHECK_EQUAL(test_trailing_ones(uint16_t(0x000F)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_count_trailing_ones_32) + { + etl::fnv_1a_32 hash; + + for (size_t i = 0UL; i < 100000UL; ++i) + { + hash.add(1); + + uint32_t value = hash.value(); + + CHECK_EQUAL(test_trailing_ones(value), etl::count_trailing_ones(value)); + + if (test_trailing_ones(value) != etl::count_trailing_ones(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_count_trailing_ones_32_constexpr) + { + char temp[etl::count_trailing_ones(uint32_t(0x0000000F))]; + + CHECK_EQUAL(test_trailing_ones(uint32_t(0x0000000F)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_count_trailing_ones_64) + { + etl::fnv_1a_64 hash; + + for (size_t i = 0UL; i < 100000UL; ++i) + { + hash.add(1); + + uint64_t value = hash.value(); + + CHECK_EQUAL(test_trailing_ones(value), etl::count_trailing_ones(value)); + + if (test_trailing_ones(value) != etl::count_trailing_ones(value)) + { + break; + } + } + } +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_count_trailing_ones_64_constexpr) + { + char temp[etl::count_trailing_ones(uint64_t(0x000000000000000F))]; + + CHECK_EQUAL(test_trailing_ones(uint64_t(0x000000000000000F)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_count_leading_zeros_8) + { + for (size_t i = 0; i < 256; ++i) + { + uint8_t value = uint8_t(i); + + CHECK_EQUAL(int(test_leading_zeros(value)), int(etl::count_leading_zeros(value))); + + if (test_leading_zeros(value) != etl::count_leading_zeros(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_count_leading_zeros_8_constexpr) + { + char temp[etl::count_leading_zeros(uint8_t(0x01U))]; + + CHECK_EQUAL(test_leading_zeros(uint8_t(0x01U)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_count_leading_zeros_16) + { + for (size_t i = 0; i < 65536; ++i) + { + uint16_t value = uint16_t(i); + + CHECK_EQUAL(int(test_leading_zeros(value)), int(etl::count_leading_zeros(value))); + + if (test_leading_zeros(value) != etl::count_leading_zeros(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_count_leading_zeros_16_constexpr) + { + char temp[etl::count_leading_zeros(uint16_t(0x0800U))]; + + CHECK_EQUAL(test_leading_zeros(uint16_t(0x0800U)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_count_leading_zeros_32) + { + etl::fnv_1a_32 hash; + + for (size_t i = 0; i < 100000; ++i) + { + hash.add(1); + + uint32_t value = hash.value(); + + CHECK_EQUAL(int(test_leading_zeros(value)), int(etl::count_leading_zeros(value))); + + if (test_leading_zeros(value) != etl::count_leading_zeros(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_count_leading_zeros_32_constexpr) + { + char temp[etl::count_leading_zeros(uint32_t(0x08000000U))]; + + CHECK_EQUAL(test_leading_zeros(uint32_t(0x08000000U)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_count_leading_zeros_64) + { + etl::fnv_1a_64 hash; + + for (size_t i = 0; i < 100000; ++i) + { + hash.add(1); + + uint64_t value = hash.value(); + + CHECK_EQUAL(int(test_leading_zeros(value)), int(etl::count_leading_zeros(value))); + + if (test_leading_zeros(value) != etl::count_leading_zeros(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_count_leading_zeros_64_constexpr) + { + char temp[etl::count_leading_zeros(uint64_t(0x0800000000000000U))]; + + CHECK_EQUAL(test_leading_zeros(uint64_t(0x0800000000000000U)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_count_leading_ones_8) + { + for (size_t i = 0; i < 256; ++i) + { + uint8_t value = uint8_t(i); + + CHECK_EQUAL(int(test_leading_ones(value)), int(etl::count_leading_ones(value))); + + if (test_leading_ones(value) != etl::count_leading_ones(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_count_leading_ones_8_constexpr) + { + char temp[etl::count_leading_ones(uint8_t(0xF0U))]; + + CHECK_EQUAL(test_leading_ones(uint8_t(0xF0U)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_count_leading_ones_16) + { + for (size_t i = 0; i < 65536; ++i) + { + uint16_t value = uint16_t(i); + + CHECK_EQUAL(int(test_leading_ones(value)), int(etl::count_leading_ones(value))); + + if (test_leading_ones(value) != etl::count_leading_ones(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_count_leading_ones_16_constexpr) + { + char temp[etl::count_leading_ones(uint16_t(0xF000U))]; + + CHECK_EQUAL(test_leading_ones(uint16_t(0xF000U)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_count_leading_ones_32) + { + etl::fnv_1a_32 hash; + + for (size_t i = 0; i < 100000; ++i) + { + hash.add(1); + + uint32_t value = hash.value(); + + CHECK_EQUAL(int(test_leading_ones(value)), int(etl::count_leading_ones(value))); + + if (test_leading_ones(value) != etl::count_leading_ones(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_count_leading_ones_32_constexpr) + { + char temp[etl::count_leading_ones(uint32_t(0xF0000000UL))]; + + CHECK_EQUAL(test_leading_ones(uint32_t(0xF0000000UL)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_count_leading_ones_64) + { + etl::fnv_1a_64 hash; + + for (size_t i = 0; i < 100000; ++i) + { + hash.add(1); + + uint64_t value = hash.value(); + + CHECK_EQUAL(int(test_leading_ones(value)), int(etl::count_leading_ones(value))); + + if (test_leading_ones(value) != etl::count_leading_ones(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_count_leading_ones_64_constexpr) + { + char temp[etl::count_leading_ones(uint64_t(0xF000000000000000UL))]; + + CHECK_EQUAL(test_leading_ones(uint64_t(0xF000000000000000UL)), sizeof(temp)); + } +#endif }; } diff --git a/test/test_bit.cpp b/test/test_bit.cpp new file mode 100644 index 00000000..7be8d51d --- /dev/null +++ b/test/test_bit.cpp @@ -0,0 +1,1493 @@ +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +https://www.etlcpp.com + +Copyright(c) 2021 jwellbelove + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +******************************************************************************/ + +#include "unit_test_framework.h" + +#include + +#include "etl/binary.h" +#include "etl/bit.h" +#include "etl/fnv_1.h" + +namespace +{ + //*********************************** + // Count bits the long way. + template + size_t test_count(T value) + { + size_t count = 0UL; + + for (int i = 0; i < etl::integral_limits::bits; ++i) + { + if ((value & (T(1) << i)) != 0) + { + ++count; + } + } + + return count; + } + + //*********************************** + // Count trailing zeros the long way. + template + size_t test_trailing_zeros(T value) + { + size_t count = 0UL; + + for (int i = 0; i < etl::integral_limits::bits; ++i) + { + if ((value & 1) == 0) + { + ++count; + } + else + { + return count; + } + + value >>= 1; + } + + return count; + } + + //*********************************** + // Count leading zeros the long way. + template + size_t test_leading_zeros(T value) + { + value = etl::reverse_bits(value); + return test_trailing_zeros(value); + } + + //*********************************** + // Count trailing ones the long way. + template + size_t test_trailing_ones(T value) + { + size_t count = 0UL; + + for (int i = 0; i < etl::integral_limits::bits; ++i) + { + if ((value & 1) == 1) + { + ++count; + } + else + { + return count; + } + + value >>= 1; + } + + return count; + } + + //*********************************** + // Count leading ones the long way. + template + size_t test_leading_ones(T value) + { + value = etl::reverse_bits(value); + return test_trailing_ones(value); + } + + //*********************************** + // Check parity the long way. + template + size_t test_parity(T value) + { + size_t count = test_count(value); + + return count & 1; + } + + //*********************************** + // Power of 2. + uint64_t test_power_of_2(int power) + { + uint64_t result = 1ULL; + + for (int i = 0; i < power; ++i) + { + result *= 2; + } + + return result; + } + + //*********************************** + // Count the bit width the long way. + template + T test_bit_width(T value) + { + value = etl::reverse_bits(value); + + size_t width = 0U; + + for (int i = 0; i < etl::integral_limits::bits; ++i) + { + if ((value & T(T(1) << i)) == 0) + { + ++width; + } + else + { + break; + } + } + + return T(etl::integral_limits::bits - width); + } + + //*********************************** + // Count the bit ceil the long way. + template + T test_bit_ceil(T value) + { + T ceil; + + if (value == T(0)) + { + ceil = T(1); + } + else + { + ceil = T(1) << test_bit_width(T(value - T(1))); + } + + return ceil; + } + + //*********************************** + // Count the bit floor the long way. + template + T test_bit_floor(T value) + { + if (value == 0) + { + return 0; + } + + T floor = T(T(1) << (etl::integral_limits::bits - T(1))); + + for (int i = etl::integral_limits::bits - 1U; (i > 0) && (floor > value); ++i) + { + floor >>= 1; + } + + return floor; + } + + SUITE(test_bit) + { + //************************************************************************* + TEST(test_rotl_8) + { + uint8_t value; + + value = 0x00U; + value = etl::rotl(value, 1); + CHECK_EQUAL(0, int(value)); + + value = 0x21U; + value = etl::rotl(value, 1); + CHECK_EQUAL(0x42U, int(value)); + + value = 0x42U; + value = etl::rotl(value, 1); + CHECK_EQUAL(0x84U, int(value)); + + value = 0x84U; + value = etl::rotl(value, 1); + CHECK_EQUAL(0x09U, int(value)); + + value = 0xB7U; + value = etl::rotl(value, 2); + CHECK_EQUAL(0xDEU, int(value)); + + value = 0xB7U; + value = etl::rotl(value, 3); + CHECK_EQUAL(0xBDU, int(value)); + + value = 0xB7U; + value = etl::rotl(value, 4); + CHECK_EQUAL(0x7BU, int(value)); + + value = 0xB7U; + value = etl::rotl(value, 5); + CHECK_EQUAL(0xF6U, int(value)); + + value = 0xB7U; + value = etl::rotl(value, 6); + CHECK_EQUAL(0xEDU, int(value)); + + value = 0xB7U; + value = etl::rotl(value, 7); + CHECK_EQUAL(0xDBU, int(value)); + + value = 0xB7U; + value = etl::rotl(value, 8); + CHECK_EQUAL(0xB7U, int(value)); + + value = 0xB7U; + value = etl::rotl(value, 9); + CHECK_EQUAL(0x6FU, int(value)); + + value = 0xB7U; + value = etl::rotl(value, -1); + CHECK_EQUAL(0xDBU, int(value)); + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_rotl_8_constexpr) + { + char temp[etl::rotl(uint8_t(0xAAU), 1)]; + + CHECK_EQUAL(etl::rotl(uint8_t(0xAAU), 1), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_rotl_16) + { + uint16_t value; + + value = 0x0000U; + value = etl::rotl(value, 1); + CHECK_EQUAL(0, value); + + value = 0x8421U; + value = etl::rotl(value, 1); + CHECK_EQUAL(0x0843U, value); + + value = 0x0843U; + value = etl::rotl(value, 1); + CHECK_EQUAL(0x1086U, value); + + value = 0x1086U; + value = etl::rotl(value, 1); + CHECK_EQUAL(0x210CU, value); + + value = 0xB73CU; + value = etl::rotl(value, 2); + CHECK_EQUAL(0xDCF2U, int(value)); + + value = 0xB73CU; + value = etl::rotl(value, 3); + CHECK_EQUAL(0xB9E5U, int(value)); + + value = 0xB73CU; + value = etl::rotl(value, 4); + CHECK_EQUAL(0x73CBU, int(value)); + + value = 0xB73CU; + value = etl::rotl(value, 5); + CHECK_EQUAL(0xE796U, int(value)); + + value = 0xB73CU; + value = etl::rotl(value, 6); + CHECK_EQUAL(0xCF2DU, int(value)); + + value = 0xB73CU; + value = etl::rotl(value, 7); + CHECK_EQUAL(0x9E5BU, int(value)); + + value = 0xB73CU; + value = etl::rotl(value, 8); + CHECK_EQUAL(0x3CB7U, int(value)); + + value = 0xB73CU; + value = etl::rotl(value, 9); + CHECK_EQUAL(0x796EU, int(value)); + + value = 0xB73CU; + value = etl::rotl(value, 9); + CHECK_EQUAL(0x796EU, int(value)); + + value = 0xB73CU; + value = etl::rotl(value, 10); + CHECK_EQUAL(0xF2DCU, int(value)); + + value = 0xB73CU; + value = etl::rotl(value, 11); + CHECK_EQUAL(0xE5B9U, int(value)); + + value = 0xB73CU; + value = etl::rotl(value, 12); + CHECK_EQUAL(0xCB73U, int(value)); + + value = 0xB73CU; + value = etl::rotl(value, 13); + CHECK_EQUAL(0x96E7U, int(value)); + + value = 0xB73CU; + value = etl::rotl(value, 14); + CHECK_EQUAL(0x2DCFU, int(value)); + + value = 0xB73CU; + value = etl::rotl(value, 15); + CHECK_EQUAL(0x5B9EU, int(value)); + + value = 0xB73CU; + value = etl::rotl(value, 16); + CHECK_EQUAL(0xB73CU, int(value)); + + value = 0xB73CU; + value = etl::rotl(value, 17); + CHECK_EQUAL(0x6E79U, int(value)); + + value = 0xB73CU; + value = etl::rotl(value, -1); + CHECK_EQUAL(0x5B9EU, int(value)); + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_rotl_16_constexpr) + { + char temp[etl::rotl(uint16_t(0xAAU), 1)]; + + CHECK_EQUAL(etl::rotl(uint16_t(0xAAU), 1), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_test_rotr_8) + { + uint8_t value; + + value = 0x00U; + value = etl::rotr(value, 1); + CHECK_EQUAL(0, int(value)); + + value = 0x21U; + value = etl::rotr(value, 1); + CHECK_EQUAL(0x90U, int(value)); + + value = 0x42U; + value = etl::rotr(value, 1); + CHECK_EQUAL(0x21U, int(value)); + + value = 0x84U; + value = etl::rotr(value, 1); + CHECK_EQUAL(0x42U, int(value)); + + value = 0xB7U; + value = etl::rotr(value, 2); + CHECK_EQUAL(0xEDU, int(value)); + + value = 0xB7U; + value = etl::rotr(value, 3); + CHECK_EQUAL(0xF6U, int(value)); + + value = 0xB7U; + value = etl::rotr(value, 4); + CHECK_EQUAL(0x7BU, int(value)); + + value = 0xB7U; + value = etl::rotr(value, 5); + CHECK_EQUAL(0xBDU, int(value)); + + value = 0xB7U; + value = etl::rotr(value, 6); + CHECK_EQUAL(0xDEU, int(value)); + + value = 0xB7U; + value = etl::rotr(value, 7); + CHECK_EQUAL(0x6FU, int(value)); + + value = 0xB7U; + value = etl::rotr(value, 8); + CHECK_EQUAL(0xB7U, int(value)); + + value = 0xB7U; + value = etl::rotr(value, 9); + CHECK_EQUAL(0xDBU, int(value)); + + value = 0xB7U; + value = etl::rotr(value, -1); + CHECK_EQUAL(0x6FU, int(value)); + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_rotr_8_constexpr) + { + char temp[etl::rotr(uint8_t(0xAAU), 1)]; + + CHECK_EQUAL(etl::rotr(uint8_t(0xAAU), 1), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_rotr_16) + { + uint16_t value; + + value = 0x0000U; + value = etl::rotr(value, 1); + CHECK_EQUAL(0, value); + + value = 0x8421U; + value = etl::rotr(value, 1); + CHECK_EQUAL(0xC210U, value); + + value = 0xC210U; + value = etl::rotr(value, 1); + CHECK_EQUAL(0x6108U, value); + + value = 0x6108U; + value = etl::rotr(value, 1); + CHECK_EQUAL(0x3084U, value); + + value = 0xB73CU; + value = etl::rotr(value, 2); + CHECK_EQUAL(0x2DCFU, int(value)); + + value = 0xB73CU; + value = etl::rotr(value, 3); + CHECK_EQUAL(0x96E7U, int(value)); + + value = 0xB73CU; + value = etl::rotr(value, 4); + CHECK_EQUAL(0xCB73U, int(value)); + + value = 0xB73CU; + value = etl::rotr(value, 5); + CHECK_EQUAL(0xE5B9U, int(value)); + + value = 0xB73CU; + value = etl::rotr(value, 6); + CHECK_EQUAL(0xF2DCU, int(value)); + + value = 0xB73CU; + value = etl::rotr(value, 7); + CHECK_EQUAL(0x796EU, int(value)); + + value = 0xB73CU; + value = etl::rotr(value, 8); + CHECK_EQUAL(0x3CB7U, int(value)); + + value = 0xB73CU; + value = etl::rotr(value, 9); + CHECK_EQUAL(0x9E5BU, int(value)); + + value = 0xB73CU; + value = etl::rotr(value, 9); + CHECK_EQUAL(0x9E5BU, int(value)); + + value = 0xB73CU; + value = etl::rotr(value, 10); + CHECK_EQUAL(0xCF2DU, int(value)); + + value = 0xB73CU; + value = etl::rotr(value, 11); + CHECK_EQUAL(0xE796U, int(value)); + + value = 0xB73CU; + value = etl::rotr(value, 12); + CHECK_EQUAL(0x73CBU, int(value)); + + value = 0xB73CU; + value = etl::rotr(value, 13); + CHECK_EQUAL(0xB9E5U, int(value)); + + value = 0xB73CU; + value = etl::rotr(value, 14); + CHECK_EQUAL(0xDCF2U, int(value)); + + value = 0xB73CU; + value = etl::rotr(value, 15); + CHECK_EQUAL(0x6E79U, int(value)); + + value = 0xB73CU; + value = etl::rotr(value, 16); + CHECK_EQUAL(0xB73CU, int(value)); + + value = 0xB73CU; + value = etl::rotr(value, 17); + CHECK_EQUAL(0x5B9EU, int(value)); + + value = 0xB73CU; + value = etl::rotr(value, -1); + CHECK_EQUAL(0x6E79U, int(value)); + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_rotr_16_constexpr) + { + char temp[etl::rotr(uint16_t(0xAAU), 1)]; + + CHECK_EQUAL(etl::rotr(uint16_t(0xAAU), 1), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_rotate16) + { + uint16_t value; + int offset; + + offset = 4; + value = 0xB73CU; + value = etl::rotate(value, offset); + CHECK_EQUAL(0x73CBU, int(value)); + + offset = -4; + value = 0xB73CU; + value = etl::rotate(value, offset); + CHECK_EQUAL(0xCB73U, int(value)); + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_rotate16_constexpr) + { + char temp[etl::rotate(uint16_t(0xAAU), 1)]; + + CHECK_EQUAL(etl::rotate(uint16_t(0xAAU), 1), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_byteswap_16) + { + uint16_t value; + + value = 0xFC5AU; + value = etl::byteswap(value); + CHECK_EQUAL(0x5AFCU, value); + + value = 0x5AA5U; + value = etl::byteswap(value); + CHECK_EQUAL(0xA55AU, value); + + value = 0xA55AU; + value = etl::byteswap(value); + CHECK_EQUAL(0x5AA5U, value); + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_byteswap_16_constexpr) + { + char temp[etl::byteswap(uint16_t(0xA500U))]; + + CHECK_EQUAL(etl::byteswap(uint16_t(0xA500U)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_byteswap_32) + { + uint32_t value; + + value = 0xF0C3A55AUL; + value = etl::byteswap(value); + CHECK_EQUAL(0x5AA5C3F0UL, value); + + value = 0xA5A55A5AUL; + value = etl::byteswap(value); + CHECK_EQUAL(0x5A5AA5A5UL, value); + + value = 0x5A5AA5A5UL; + value = etl::byteswap(value); + CHECK_EQUAL(0xA5A55A5AUL, value); + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_byteswap_32_constexpr) + { + char temp[etl::byteswap(uint32_t(0xA5000000UL))]; + + CHECK_EQUAL(etl::byteswap(uint32_t(0xA5000000UL)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_byteswap_64) + { + uint64_t value; + + value = 0x0123456789ABCDEFULL; + value = etl::byteswap(value); + CHECK_EQUAL(0xEFCDAB8967452301ULL, value); + + value = 0xA5A55A5AA5A55A5AULL; + value = etl::byteswap(value); + CHECK_EQUAL(0x5A5AA5A55A5AA5A5ULL, value); + + value = 0x5A5AA5A55A5AA5A5ULL; + value = etl::byteswap(value); + CHECK_EQUAL(0xA5A55A5AA5A55A5AULL, value); + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_byteswap_64_constexpr) + { + char temp[etl::byteswap(uint64_t(0xA500000000000000ULL))]; + + CHECK_EQUAL(etl::byteswap(uint64_t(0xA500000000000000ULL)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_popcount_8) + { + for (size_t i = 1UL; i <= std::numeric_limits::max(); ++i) + { + CHECK_EQUAL(test_count(i), etl::popcount(uint8_t(i))); + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_popcount_8_constexpr) + { + char temp[etl::popcount(uint8_t(0xFFU))]; + + CHECK_EQUAL(etl::popcount(uint8_t(0xFFU)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_popcount_16) + { + for (size_t i = 1UL; i <= std::numeric_limits::max(); ++i) + { + CHECK_EQUAL(test_count(i), etl::popcount(uint16_t(i))); + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_popcount_16_constexpr) + { + char temp[etl::popcount(uint16_t(0xFFU))]; + + CHECK_EQUAL(etl::popcount(uint16_t(0xFFU)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_popcount_32) + { + etl::fnv_1a_32 hash; + + for (size_t i = 0UL; i < 1000000UL; ++i) + { + hash.add(1); + + uint32_t value = hash.value(); + + CHECK_EQUAL(test_count(value), etl::popcount(value)); + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_popcount_32_constexpr) + { + char temp[etl::popcount(uint32_t(0xFFU))]; + + CHECK_EQUAL(etl::popcount(uint32_t(0xFFU)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_popcount_64) + { + etl::fnv_1a_64 hash; + + for (size_t i = 0UL; i < 1000000UL; ++i) + { + hash.add(1); + + uint64_t value = hash.value(); + + CHECK_EQUAL(test_count(value), etl::popcount(value)); + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_popcount_64_constexpr) + { + char temp[etl::popcount(uint64_t(0xFFU))]; + + CHECK_EQUAL(etl::popcount(uint64_t(0xFFU)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_countr_zero_8) + { + etl::fnv_1a_32 hash; + + for (size_t i = 0; i < 256; ++i) + { + uint8_t value = uint8_t(i); + + CHECK_EQUAL(test_trailing_zeros(value), etl::countr_zero(value)); + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_countr_zero_8_constexpr) + { + char temp[etl::countr_zero(uint8_t(0x08))]; + + CHECK_EQUAL(etl::countr_zero(uint8_t(0x08)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_countr_zero_16) + { + for (size_t i = 0; i < 65536; ++i) + { + uint16_t value = uint16_t(i); + + CHECK_EQUAL(test_trailing_zeros(value), etl::countr_zero(value)); + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_countr_zero_16_constexpr) + { + char temp[etl::countr_zero(uint16_t(0x08))]; + + CHECK_EQUAL(etl::countr_zero(uint16_t(0x08)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_countr_zero_32) + { + etl::fnv_1a_32 hash; + + for (size_t i = 0UL; i < 100000UL; ++i) + { + hash.add(1); + + uint32_t value = hash.value(); + + CHECK_EQUAL(test_trailing_zeros(value), etl::countr_zero(value)); + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_countr_zero_32_constexpr) + { + char temp[etl::countr_zero(uint32_t(0x08))]; + + CHECK_EQUAL(etl::countr_zero(uint32_t(0x08)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_countr_zero_64) + { + etl::fnv_1a_64 hash; + + for (size_t i = 0UL; i < 100000UL; ++i) + { + hash.add(1); + + uint64_t value = hash.value(); + + CHECK_EQUAL(test_trailing_zeros(value), etl::countr_zero(value)); + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_countr_zero_64_constexpr) + { + char temp[etl::countr_zero(uint64_t(0x08))]; + + CHECK_EQUAL(etl::countr_zero(uint64_t(0x08)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_countr_one_8) + { + for (size_t i = 0; i < 256; ++i) + { + uint8_t value = uint8_t(i); + + CHECK_EQUAL(int(test_trailing_ones(value)), int(etl::countr_one(value))); + + if (test_trailing_ones(value) != etl::countr_one(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_countr_one_8_constexpr) + { + char temp[etl::countr_one(uint8_t(0x0F))]; + + CHECK_EQUAL(test_trailing_ones(uint8_t(0x0F)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_countr_one_16) + { + for (size_t i = 0; i < 65536; ++i) + { + uint16_t value = uint16_t(i); + + CHECK_EQUAL(int(test_trailing_ones(value)), int(etl::countr_one(value))); + + if (test_trailing_ones(value) != etl::countr_one(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_countr_one_16_constexpr) + { + char temp[etl::countr_one(uint16_t(0x000F))]; + + CHECK_EQUAL(test_trailing_ones(uint16_t(0x000F)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_countr_one_32) + { + etl::fnv_1a_32 hash; + + for (size_t i = 0UL; i < 100000UL; ++i) + { + hash.add(1); + + uint32_t value = hash.value(); + + CHECK_EQUAL(test_trailing_ones(value), etl::countr_one(value)); + + if (test_trailing_ones(value) != etl::countr_one(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_countr_one_32_constexpr) + { + char temp[etl::countr_one(uint32_t(0x0000000F))]; + + CHECK_EQUAL(test_trailing_ones(uint32_t(0x0000000F)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_countr_one_64) + { + etl::fnv_1a_64 hash; + + for (size_t i = 0UL; i < 100000UL; ++i) + { + hash.add(1); + + uint64_t value = hash.value(); + + CHECK_EQUAL(test_trailing_ones(value), etl::countr_one(value)); + + if (test_trailing_ones(value) != etl::countr_one(value)) + { + break; + } + } + } +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_countr_one_64_constexpr) + { + char temp[etl::countr_one(uint64_t(0x000000000000000F))]; + + CHECK_EQUAL(test_trailing_ones(uint64_t(0x000000000000000F)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_countl_zero_8) + { + for (size_t i = 0; i < 256; ++i) + { + uint8_t value = uint8_t(i); + + CHECK_EQUAL(int(test_leading_zeros(value)), int(etl::countl_zero(value))); + + if (test_leading_zeros(value) != etl::countl_zero(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_countl_zero_8_constexpr) + { + char temp[etl::countl_zero(uint8_t(0x01U))]; + + CHECK_EQUAL(test_leading_zeros(uint8_t(0x01U)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_countl_zero_16) + { + for (size_t i = 0; i < 65536; ++i) + { + uint16_t value = uint16_t(i); + + CHECK_EQUAL(int(test_leading_zeros(value)), int(etl::countl_zero(value))); + + if (test_leading_zeros(value) != etl::countl_zero(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_countl_zero_16_constexpr) + { + char temp[etl::countl_zero(uint16_t(0x0800U))]; + + CHECK_EQUAL(test_leading_zeros(uint16_t(0x0800U)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_countl_zero_32) + { + etl::fnv_1a_32 hash; + + for (size_t i = 0; i < 100000; ++i) + { + hash.add(1); + + uint32_t value = hash.value(); + + CHECK_EQUAL(int(test_leading_zeros(value)), int(etl::countl_zero(value))); + + if (test_leading_zeros(value) != etl::countl_zero(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_countl_zero_32_constexpr) + { + char temp[etl::countl_zero(uint32_t(0x08000000U))]; + + CHECK_EQUAL(test_leading_zeros(uint32_t(0x08000000U)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_countl_zero_64) + { + etl::fnv_1a_64 hash; + + for (size_t i = 0; i < 100000; ++i) + { + hash.add(1); + + uint64_t value = hash.value(); + + CHECK_EQUAL(int(test_leading_zeros(value)), int(etl::countl_zero(value))); + + if (test_leading_zeros(value) != etl::countl_zero(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_countl_zero_64_constexpr) + { + char temp[etl::countl_zero(uint64_t(0x0800000000000000U))]; + + CHECK_EQUAL(test_leading_zeros(uint64_t(0x0800000000000000U)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_countl_one_8) + { + for (size_t i = 0; i < 256; ++i) + { + uint8_t value = uint8_t(i); + + CHECK_EQUAL(int(test_leading_ones(value)), int(etl::countl_one(value))); + + if (test_leading_ones(value) != etl::countl_one(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_countl_one_8_constexpr) + { + char temp[etl::countl_one(uint8_t(0xF0U))]; + + CHECK_EQUAL(test_leading_ones(uint8_t(0xF0U)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_countl_one_16) + { + for (size_t i = 0; i < 65536; ++i) + { + uint16_t value = uint16_t(i); + + CHECK_EQUAL(int(test_leading_ones(value)), int(etl::countl_one(value))); + + if (test_leading_ones(value) != etl::countl_one(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_countl_one_16_constexpr) + { + char temp[etl::countl_one(uint16_t(0xF000U))]; + + CHECK_EQUAL(test_leading_ones(uint16_t(0xF000U)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_countl_one_32) + { + etl::fnv_1a_32 hash; + + for (size_t i = 0; i < 100000; ++i) + { + hash.add(1); + + uint32_t value = hash.value(); + + CHECK_EQUAL(int(test_leading_ones(value)), int(etl::countl_one(value))); + + if (test_leading_ones(value) != etl::countl_one(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_countl_one_32_constexpr) + { + char temp[etl::countl_one(uint32_t(0xF0000000UL))]; + + CHECK_EQUAL(test_leading_ones(uint32_t(0xF0000000UL)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_countl_one_64) + { + etl::fnv_1a_64 hash; + + for (size_t i = 0; i < 100000; ++i) + { + hash.add(1); + + uint64_t value = hash.value(); + + CHECK_EQUAL(int(test_leading_ones(value)), int(etl::countl_one(value))); + + if (test_leading_ones(value) != etl::countl_one(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_countl_one_64_constexpr) + { + char temp[etl::countl_one(uint64_t(0xF000000000000000UL))]; + + CHECK_EQUAL(test_leading_ones(uint64_t(0xF000000000000000UL)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_bit_ceil_8) + { + for (size_t i = 0; i < 256; ++i) + { + uint8_t value = uint8_t(i); + + CHECK_EQUAL(int(test_bit_ceil(value)), int(etl::bit_ceil(value))); + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_bit_ceil_8_constexpr) + { + char temp[etl::bit_ceil(uint8_t(1))]; + + CHECK_EQUAL(test_bit_ceil(uint8_t(1)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_bit_ceil_16) + { + etl::fnv_1a_32 hash; + + for (size_t i = 0; i < 100000; ++i) + { + hash.add(1); + + uint16_t value = hash.value(); + + CHECK_EQUAL(test_bit_ceil(value), etl::bit_ceil(value)); + + if (test_bit_ceil(value) != etl::bit_ceil(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_bit_ceil_16_constexpr) + { + char temp[etl::bit_ceil(uint16_t(1))]; + + CHECK_EQUAL(test_bit_ceil(uint16_t(1)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_bit_ceil_32) + { + etl::fnv_1a_32 hash; + + for (size_t i = 0; i < 100000; ++i) + { + hash.add(1); + + uint32_t value = hash.value(); + + CHECK_EQUAL(test_bit_ceil(value), etl::bit_ceil(value)); + + if (test_bit_ceil(value) != etl::bit_ceil(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_bit_ceil_32_constexpr) + { + char temp[etl::bit_ceil(uint32_t(1))]; + + CHECK_EQUAL(test_bit_ceil(uint32_t(1)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_bit_ceil_64) + { + etl::fnv_1a_64 hash; + + for (size_t i = 0; i < 100000; ++i) + { + hash.add(1); + + uint64_t value = hash.value(); + + CHECK_EQUAL(test_bit_ceil(value), etl::bit_ceil(value)); + + if (test_bit_ceil(value) != etl::bit_ceil(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_bit_ceil_64_constexpr) + { + char temp[etl::bit_ceil(uint64_t(1))]; + + CHECK_EQUAL(test_bit_ceil(uint64_t(1)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_bit_floor_8) + { + for (size_t i = 0; i < 256; ++i) + { + uint8_t value = uint8_t(i); + + CHECK_EQUAL(int(test_bit_floor(value)), int(etl::bit_floor(value))); + } + } + + //************************************************************************* + TEST(test_bit_floor_16) + { + etl::fnv_1a_32 hash; + + for (size_t i = 0; i < 100000; ++i) + { + hash.add(1); + + uint16_t value = hash.value(); + + CHECK_EQUAL(test_bit_floor(value), etl::bit_floor(value)); + + if (test_bit_floor(value) != etl::bit_floor(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_bit_floor_16_constexpr) + { + char temp[etl::bit_floor(uint16_t(1))]; + + CHECK_EQUAL(test_bit_floor(uint16_t(1)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_bit_floor_32) + { + etl::fnv_1a_32 hash; + + for (size_t i = 0; i < 100000; ++i) + { + hash.add(1); + + uint32_t value = hash.value(); + + CHECK_EQUAL(test_bit_floor(value), etl::bit_floor(value)); + + if (test_bit_floor(value) != etl::bit_floor(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_bit_floor_32_constexpr) + { + char temp[etl::bit_floor(uint32_t(1))]; + + CHECK_EQUAL(test_bit_floor(uint32_t(1)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_bit_floor_64) + { + etl::fnv_1a_64 hash; + + for (size_t i = 0; i < 100000; ++i) + { + hash.add(1); + + uint64_t value = hash.value(); + + CHECK_EQUAL(test_bit_floor(value), etl::bit_floor(value)); + + if (test_bit_floor(value) != etl::bit_floor(value)) + { + break; + } + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_bit_floor_64_constexpr) + { + char temp[etl::bit_floor(uint64_t(1))]; + + CHECK_EQUAL(test_bit_floor(uint64_t(1)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_bit_width_8) + { + for (size_t i = 0; i < 256; ++i) + { + uint8_t value = uint8_t(i); + + CHECK_EQUAL(int(test_bit_width(value)), int(etl::bit_width(value))); + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_bit_width_8_constexpr) + { + char temp[etl::bit_width(uint8_t(0xAU))]; + + CHECK_EQUAL(test_bit_width(uint8_t(0xAU)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_bit_width_16) + { + etl::fnv_1a_32 hash; + + for (size_t i = 0; i < 100000; ++i) + { + hash.add(1); + + uint16_t value = hash.value(); + + CHECK_EQUAL(test_bit_width(value), etl::bit_width(value)); + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_bit_width_16_constexpr) + { + char temp[etl::bit_width(uint16_t(0xAU))]; + + CHECK_EQUAL(test_bit_width(uint16_t(0xAU)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_bit_width_32) + { + etl::fnv_1a_32 hash; + + for (size_t i = 0; i < 100000; ++i) + { + hash.add(1); + + uint32_t value = hash.value(); + + CHECK_EQUAL(test_bit_width(value), etl::bit_width(value)); + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_bit_width_32_constexpr) + { + char temp[etl::bit_width(uint32_t(0xAU))]; + + CHECK_EQUAL(test_bit_width(uint32_t(0xAU)), sizeof(temp)); + } +#endif + + //************************************************************************* + TEST(test_bit_width_64) + { + etl::fnv_1a_64 hash; + + for (size_t i = 0; i < 100000; ++i) + { + hash.add(1); + + uint64_t value = hash.value(); + + CHECK_EQUAL(test_bit_width(value), etl::bit_width(value)); + } + } + +#if !defined(ETL_FORCE_NO_ADVANCED_CPP) + //************************************************************************* + TEST(test_bit_width_64_constexpr) + { + char temp[etl::bit_width(uint64_t(0xAU))]; + + CHECK_EQUAL(test_bit_width(uint64_t(0xAU)), sizeof(temp)); + } +#endif + }; +} + diff --git a/test/test_delegate.cpp b/test/test_delegate.cpp index d5ee2acf..0e574d38 100644 --- a/test/test_delegate.cpp +++ b/test/test_delegate.cpp @@ -33,6 +33,8 @@ SOFTWARE. #if !defined(ETL_CRC_FORCE_CPP03_IMPLEMENTATION) +#include + namespace { //***************************************************************************** @@ -1103,6 +1105,19 @@ namespace CHECK(!function_called); CHECK(!parameter_correct); } + + //************************************************************************* + TEST_FIXTURE(SetupFixture, test_construct_from_std_function_from_free_int) + { + std::function std_function(free_int); + + etl::delegate d(std_function); + + d(VALUE1, VALUE2); + + CHECK(function_called); + CHECK(parameter_correct); + } }; } diff --git a/test/test_numeric.cpp b/test/test_numeric.cpp index ea722cb3..86e0e9d5 100644 --- a/test/test_numeric.cpp +++ b/test/test_numeric.cpp @@ -29,9 +29,15 @@ SOFTWARE. #include "unit_test_framework.h" #include "etl/numeric.h" +#include "etl/deque.h" +#include "etl/list.h" #include #include +#include +#include +#include +#include namespace { @@ -49,5 +55,153 @@ namespace CHECK(are_same); } + + //************************************************************************* + TEST(test_midpoint_signed_integral) + { + CHECK_EQUAL(int32_t(0), (etl::midpoint(int32_t(0), int32_t(0)))); + CHECK_EQUAL(int32_t(0), (etl::midpoint(int32_t(0), int32_t(1)))); + CHECK_EQUAL(int32_t(1), (etl::midpoint(int32_t(1), int32_t(0)))); + + CHECK_EQUAL(std::numeric_limits::max() / 2, (etl::midpoint(0, std::numeric_limits::max()))); + CHECK_EQUAL((std::numeric_limits::max() / 2) + 1, (etl::midpoint(std::numeric_limits::max(), 0))); + + CHECK_EQUAL(int32_t(-1), (etl::midpoint(std::numeric_limits::min(), std::numeric_limits::max()))); + CHECK_EQUAL(int32_t(0), (etl::midpoint(std::numeric_limits::max(), std::numeric_limits::min()))); + } + + //************************************************************************* + TEST(test_midpoint_unsigned_integral) + { + CHECK_EQUAL(uint32_t(0), (etl::midpoint(uint32_t(0), uint32_t(0)))); + CHECK_EQUAL(uint32_t(0), (etl::midpoint(uint32_t(0), uint32_t(1)))); + CHECK_EQUAL(uint32_t(1), (etl::midpoint(uint32_t(1), uint32_t(0)))); + + CHECK_EQUAL((std::numeric_limits::max() / 2U), (etl::midpoint(std::numeric_limits::min(), std::numeric_limits::max()))); + CHECK_EQUAL((std::numeric_limits::max() / 2U) + 1, (etl::midpoint(std::numeric_limits::max(), std::numeric_limits::min()))); + } + + //************************************************************************* + TEST(test_midpoint_floating_point) + { + CHECK_CLOSE(0.0, (etl::midpoint(0.0, 0.0)), 0.001); + + CHECK_CLOSE(0.5, (etl::midpoint(0.0, 1.0)), 0.001); + CHECK_CLOSE(0.5, (etl::midpoint(1.0, 0.0)), 0.001); + + CHECK_CLOSE(0.0, (etl::midpoint(-std::numeric_limits::max(), std::numeric_limits::max())), 0.001); + CHECK_CLOSE(0.0, (etl::midpoint(std::numeric_limits::max(), -std::numeric_limits::max())), 0.001); + } + + //************************************************************************* + TEST(test_midpoint_pointer) + { + std::vector data = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + + CHECK_EQUAL(data[5], (*etl::midpoint(data.data(), data.data() + data.size()))); + CHECK_EQUAL(data[5], (*etl::midpoint(data.data() + data.size(), data.data()))); + } + + //************************************************************************* + TEST(test_midpoint_etl_random_access_iterator) + { + std::array initial = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::deque data(initial.begin(), initial.end()); + + etl::deque::iterator b = data.begin(); + etl::deque::iterator e = data.end(); + + CHECK_EQUAL(data[5], (*etl::midpoint(b, e))); + CHECK_EQUAL(data[5], (*etl::midpoint(e, b))); + } + + //************************************************************************* + TEST(test_midpoint_etl_bidirectional_iterator) + { + std::array initial = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + etl::list data(initial.begin(), initial.end()); + + etl::list::iterator b = data.begin(); + etl::list::iterator e = data.end(); + + etl::list::iterator c = data.begin(); + etl::advance(c, 5); + + int v = *etl::midpoint(b, e); + + CHECK_EQUAL(*c, v); + } + +#if ETL_USING_STL + //************************************************************************* + TEST(test_midpoint_std_random_access_iterator) + { + std::deque data = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + + std::deque::iterator b = data.begin(); + std::deque::iterator e = data.end(); + + CHECK_EQUAL(data[5], (*etl::midpoint(b, e))); + CHECK_EQUAL(data[5], (*etl::midpoint(e, b))); + } + + //************************************************************************* + TEST(test_midpoint_std_bidirectional_iterator) + { + std::list data = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + + std::list::iterator b = data.begin(); + std::list::iterator e = data.end(); + + std::list::iterator c = data.begin(); + std::advance(c, 5); + + int v = *etl::midpoint(b, e); + + CHECK_EQUAL(*c, v); + } +#endif + + //************************************************************************* + TEST(test_lerp_floating_point) + { + CHECK_CLOSE(-10.0, etl::lerp(-10.0, 10.0, 0.0), 0.001); + CHECK_CLOSE( -8.0, etl::lerp(-10.0, 10.0, 0.1), 0.001); + CHECK_CLOSE( -6.0, etl::lerp(-10.0, 10.0, 0.2), 0.001); + CHECK_CLOSE( -4.0, etl::lerp(-10.0, 10.0, 0.3), 0.001); + CHECK_CLOSE( -2.0, etl::lerp(-10.0, 10.0, 0.4), 0.001); + CHECK_CLOSE( 0.0, etl::lerp(-10.0, 10.0, 0.5), 0.001); + CHECK_CLOSE( 2.0, etl::lerp(-10.0, 10.0, 0.6), 0.001); + CHECK_CLOSE( 4.0, etl::lerp(-10.0, 10.0, 0.7), 0.001); + CHECK_CLOSE( 6.0, etl::lerp(-10.0, 10.0, 0.8), 0.001); + CHECK_CLOSE( 8.0, etl::lerp(-10.0, 10.0, 0.9), 0.001); + CHECK_CLOSE( 10.0, etl::lerp(-10.0, 10.0, 1.0), 0.001); + + // Equal a & b + CHECK_CLOSE(10.0, etl::lerp(10.0, 10.0, 1.0), 0.001); + } + + //************************************************************************* + TEST(test_lerp_at_least_one_integral) + { + CHECK_CLOSE(-10.0, etl::lerp(-10.0, 10.0, 0), 0.001); + CHECK_CLOSE( -8.0, etl::lerp(-10, 10.0, 0.1), 0.001); + CHECK_CLOSE( -6.0, etl::lerp(-10.0, 10, 0.2), 0.001); + CHECK_CLOSE( -4.0, etl::lerp(-10, 10, 0.3), 0.001); + CHECK_CLOSE( -2.0, etl::lerp(-10, 10.0, 0.4), 0.001); + CHECK_CLOSE( 0.0, etl::lerp(-10.0, 10, 0.5), 0.001); + CHECK_CLOSE( 2.0, etl::lerp(-10, 10, 0.6), 0.001); + CHECK_CLOSE( 4.0, etl::lerp(-10, 10.0, 0.7), 0.001); + CHECK_CLOSE( 6.0, etl::lerp(-10.0, 10, 0.8), 0.001); + CHECK_CLOSE( 8.0, etl::lerp(-10, 10, 0.9), 0.001); + CHECK_CLOSE( 10.0, etl::lerp(-10.0, 10.0, 1), 0.001); + + // Equal a & b + CHECK_CLOSE(10.0, etl::lerp(10.0, 10.0, 1.0), 0.001); + CHECK_CLOSE(10.0, etl::lerp(10, 10.0, 1.0), 0.001); + CHECK_CLOSE(10.0, etl::lerp(10.0, 10, 1.0), 0.001); + CHECK_CLOSE(10.0, etl::lerp(10.0, 10.0, 1), 0.001); + CHECK_CLOSE(10.0, etl::lerp(10, 10, 1), 0.001); + } }; } diff --git a/test/test_string_stream_u16.cpp b/test/test_string_stream_u16.cpp index cb548697..fbe60600 100644 --- a/test/test_string_stream_u16.cpp +++ b/test/test_string_stream_u16.cpp @@ -68,7 +68,7 @@ namespace etl { for (auto c : str) { - os << c; + os << uint16_t(c); } return os; diff --git a/test/test_string_stream_u32.cpp b/test/test_string_stream_u32.cpp index 58d174b7..451bb137 100644 --- a/test/test_string_stream_u32.cpp +++ b/test/test_string_stream_u32.cpp @@ -68,7 +68,7 @@ namespace etl { for (auto c : str) { - os << c; + os << uint32_t(c); } return os; diff --git a/test/test_string_stream_wchar_t.cpp b/test/test_string_stream_wchar_t.cpp index af69a80e..8ea2ce82 100644 --- a/test/test_string_stream_wchar_t.cpp +++ b/test/test_string_stream_wchar_t.cpp @@ -68,7 +68,7 @@ namespace etl { for (auto c : str) { - os << c; + os << uint16_t(c); } return os; diff --git a/test/test_string_u16.cpp b/test/test_string_u16.cpp index 34b96484..56a34464 100644 --- a/test/test_string_u16.cpp +++ b/test/test_string_u16.cpp @@ -46,6 +46,22 @@ namespace ((result1 > 0) && (result2 > 0)); } + //*********************************** + std::ostream& operator << (std::ostream& os, const etl::iu16string::value_type& c) + { + os << uint16_t(c); + + return os; + } + + //*********************************** + std::ostream& operator << (std::ostream& os, const etl::iu16string::value_type* c) + { + os << (void*)c; + + return os; + } + SUITE(test_string_char) { static const size_t SIZE = 11; diff --git a/test/test_string_u16_external_buffer.cpp b/test/test_string_u16_external_buffer.cpp index bbde373c..4d6e9b30 100644 --- a/test/test_string_u16_external_buffer.cpp +++ b/test/test_string_u16_external_buffer.cpp @@ -47,6 +47,22 @@ namespace ((result1 > 0) && (result2 > 0)); } + //*********************************** + std::ostream& operator << (std::ostream& os, const etl::iu16string::value_type& c) + { + os << uint16_t(c); + + return os; + } + + //*********************************** + std::ostream& operator << (std::ostream& os, const etl::iu16string::value_type* c) + { + os << (void*)c; + + return os; + } + SUITE(test_string_char) { static constexpr size_t SIZE = 11; diff --git a/test/test_string_u32.cpp b/test/test_string_u32.cpp index 3058afdb..ccbfac21 100644 --- a/test/test_string_u32.cpp +++ b/test/test_string_u32.cpp @@ -46,6 +46,22 @@ namespace ((result1 > 0) && (result2 > 0)); } + //*********************************** + std::ostream& operator << (std::ostream& os, const etl::iu32string::value_type& c) + { + os << uint32_t(c); + + return os; + } + + //*********************************** + std::ostream& operator << (std::ostream& os, const etl::iu32string::value_type* c) + { + os << (void*)c; + + return os; + } + SUITE(test_string_char) { static const size_t SIZE = 11; diff --git a/test/test_string_u32_external_buffer.cpp b/test/test_string_u32_external_buffer.cpp index d0592438..e7e8525e 100644 --- a/test/test_string_u32_external_buffer.cpp +++ b/test/test_string_u32_external_buffer.cpp @@ -47,6 +47,22 @@ namespace ((result1 > 0) && (result2 > 0)); } + //*********************************** + std::ostream& operator << (std::ostream& os, const etl::u32string_ext::value_type& c) + { + os << uint32_t(c); + + return os; + } + + //*********************************** + std::ostream& operator << (std::ostream& os, const etl::u32string_ext::value_type* c) + { + os << (void*)c; + + return os; + } + SUITE(test_string_char) { static constexpr size_t SIZE = 11; diff --git a/test/test_string_utilities_std_u16.cpp b/test/test_string_utilities_std_u16.cpp index 3c2d1d14..b57858f5 100644 --- a/test/test_string_utilities_std_u16.cpp +++ b/test/test_string_utilities_std_u16.cpp @@ -40,6 +40,14 @@ SOFTWARE. namespace { + //*********************************** + std::ostream& operator << (std::ostream& os, const std::wstring::value_type& c) + { + os << uint16_t(c); + + return os; + } + SUITE(test_string_utilities_std_u16) { using String = std::wstring; diff --git a/test/test_string_utilities_std_u32.cpp b/test/test_string_utilities_std_u32.cpp index b56ed472..1e0ee509 100644 --- a/test/test_string_utilities_std_u32.cpp +++ b/test/test_string_utilities_std_u32.cpp @@ -40,6 +40,14 @@ SOFTWARE. namespace { + //*********************************** + std::ostream& operator << (std::ostream& os, const std::u32string::value_type& c) + { + os << uint32_t(c); + + return os; + } + SUITE(test_string_utilities_std_u32) { using String = std::u32string; diff --git a/test/test_string_utilities_std_wchar_t.cpp b/test/test_string_utilities_std_wchar_t.cpp index 6ef1e6df..fcd17722 100644 --- a/test/test_string_utilities_std_wchar_t.cpp +++ b/test/test_string_utilities_std_wchar_t.cpp @@ -40,6 +40,14 @@ SOFTWARE. namespace { + //*********************************** + std::ostream& operator << (std::ostream& os, const std::wstring::value_type& c) + { + os << uint16_t(c); + + return os; + } + SUITE(test_string_utilities_std_wchar_t) { using String = std::wstring; diff --git a/test/test_string_utilities_u16.cpp b/test/test_string_utilities_u16.cpp index 9d26a3fa..1e3eecf2 100644 --- a/test/test_string_utilities_u16.cpp +++ b/test/test_string_utilities_u16.cpp @@ -38,6 +38,14 @@ SOFTWARE. namespace { + //*********************************** + std::ostream& operator << (std::ostream& os, const std::u16string::value_type& c) + { + os << uint16_t(c); + + return os; + } + SUITE(test_string_utilities_u16) { static const size_t SIZE = 50; diff --git a/test/test_string_utilities_u32.cpp b/test/test_string_utilities_u32.cpp index d71f543d..7e32498f 100644 --- a/test/test_string_utilities_u32.cpp +++ b/test/test_string_utilities_u32.cpp @@ -38,6 +38,14 @@ SOFTWARE. namespace { + //*********************************** + std::ostream& operator << (std::ostream& os, const etl::iu32string::value_type& c) + { + os << uint32_t(c); + + return os; + } + SUITE(test_string_utilities_u32) { static const size_t SIZE = 50; diff --git a/test/test_string_utilities_wchar_t.cpp b/test/test_string_utilities_wchar_t.cpp index c4a55833..39962da8 100644 --- a/test/test_string_utilities_wchar_t.cpp +++ b/test/test_string_utilities_wchar_t.cpp @@ -38,11 +38,19 @@ SOFTWARE. namespace { + //*********************************** + std::ostream& operator << (std::ostream& os, const std::wstring::value_type& c) + { + os << uint16_t(c); + + return os; + } + SUITE(test_string_utilities_wchar_t) { static const size_t SIZE = 50; - using String = etl::wstring; + using String = etl::wstring; using IString = etl::iwstring; using StringView = etl::wstring_view; using Char = etl::iwstring::value_type; diff --git a/test/test_string_wchar_t.cpp b/test/test_string_wchar_t.cpp index 77af504c..394173d5 100644 --- a/test/test_string_wchar_t.cpp +++ b/test/test_string_wchar_t.cpp @@ -46,6 +46,22 @@ namespace ((result1 > 0) && (result2 > 0)); } + //*********************************** + std::ostream& operator << (std::ostream& os, const etl::iwstring::value_type& c) + { + os << uint16_t(c); + + return os; + } + + //*********************************** + std::ostream& operator << (std::ostream& os, const etl::iwstring::value_type* c) + { + os << (void*)c; + + return os; + } + SUITE(test_string_wchar_t) { static const size_t SIZE = 11; @@ -581,7 +597,6 @@ namespace CHECK_EQUAL(&constText[0], constText.begin()); } - //************************************************************************* TEST_FIXTURE(SetupFixture, test_end) { diff --git a/test/test_string_wchar_t_external_buffer.cpp b/test/test_string_wchar_t_external_buffer.cpp index d8ebde05..2aa20394 100644 --- a/test/test_string_wchar_t_external_buffer.cpp +++ b/test/test_string_wchar_t_external_buffer.cpp @@ -47,6 +47,22 @@ namespace ((result1 > 0) && (result2 > 0)); } + //*********************************** + std::ostream& operator << (std::ostream& os, const etl::iwstring::value_type& c) + { + os << uint16_t(c); + + return os; + } + + //*********************************** + std::ostream& operator << (std::ostream& os, const etl::iwstring::value_type* c) + { + os << (void*)c; + + return os; + } + SUITE(test_string_char) { static constexpr size_t SIZE = 11; diff --git a/test/vs2019/etl.sln b/test/vs2019/etl.sln index b35ce12b..4a418323 100644 --- a/test/vs2019/etl.sln +++ b/test/vs2019/etl.sln @@ -29,6 +29,10 @@ Global Debug MSVC - String Truncation Is Error|x64 = Debug MSVC - String Truncation Is Error|x64 Debug MSVC 64|Win32 = Debug MSVC 64|Win32 Debug MSVC 64|x64 = Debug MSVC 64|x64 + Debug MSVC C++20 - No STL|Win32 = Debug MSVC C++20 - No STL|Win32 + Debug MSVC C++20 - No STL|x64 = Debug MSVC C++20 - No STL|x64 + Debug MSVC C++20|Win32 = Debug MSVC C++20|Win32 + Debug MSVC C++20|x64 = Debug MSVC C++20|x64 Debug MSVC No Checks|Win32 = Debug MSVC No Checks|Win32 Debug MSVC No Checks|x64 = Debug MSVC No Checks|x64 Debug MSVC|Win32 = Debug MSVC|Win32 @@ -85,6 +89,14 @@ Global {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC 64|Win32.Build.0 = Debug No Unit Tests|Win32 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC 64|x64.ActiveCfg = Debug64|x64 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC 64|x64.Build.0 = Debug64|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20 - No STL|Win32.ActiveCfg = Debug MSVC C++20 - No STL|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20 - No STL|Win32.Build.0 = Debug MSVC C++20 - No STL|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20 - No STL|x64.ActiveCfg = Debug MSVC C++20 - No STL|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20 - No STL|x64.Build.0 = Debug MSVC C++20 - No STL|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20|Win32.ActiveCfg = Debug MSVC C++20|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20|Win32.Build.0 = Debug MSVC C++20|Win32 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20|x64.ActiveCfg = Debug MSVC C++20|x64 + {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC C++20|x64.Build.0 = Debug MSVC C++20|x64 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC No Checks|Win32.ActiveCfg = Debug MSVC No Checks|Win32 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC No Checks|Win32.Build.0 = Debug MSVC No Checks|Win32 {C21DF78C-D8E0-46AB-9D6F-D38A3C1CB0FB}.Debug MSVC No Checks|x64.ActiveCfg = Debug MSVC No Checks|x64 diff --git a/test/vs2019/etl.vcxproj b/test/vs2019/etl.vcxproj index 8d23922c..aace7621 100644 --- a/test/vs2019/etl.vcxproj +++ b/test/vs2019/etl.vcxproj @@ -17,6 +17,14 @@ Debug LLVM - No STL - Built-ins x64 + + Debug LLVM C++20 + Win32 + + + Debug LLVM C++20 + x64 + Debug LLVM Win32 @@ -65,6 +73,22 @@ Debug MSVC - No Checks x64 + + Debug MSVC C++20 - No STL + Win32 + + + Debug MSVC C++20 - No STL + x64 + + + Debug MSVC C++20 + Win32 + + + Debug MSVC C++20 + x64 + Debug64 Win32 @@ -161,6 +185,20 @@ Unicode false + + Application + true + v142 + Unicode + false + + + Application + true + v142 + Unicode + false + Application true @@ -237,6 +275,12 @@ ClangCL Unicode + + Application + true + ClangCL + Unicode + Application true @@ -273,6 +317,18 @@ v142 Unicode + + Application + true + v142 + Unicode + + + Application + true + v142 + Unicode + Application true @@ -345,6 +401,12 @@ v142 Unicode + + Application + true + v142 + Unicode + Application true @@ -425,6 +487,12 @@ + + + + + + @@ -461,6 +529,9 @@ + + + @@ -479,6 +550,12 @@ + + + + + + @@ -515,6 +592,9 @@ + + + @@ -554,6 +634,16 @@ true $(Configuration)\ + + true + true + $(Configuration)\ + + + true + true + $(Configuration)\ + true true @@ -620,6 +710,11 @@ true $(Configuration)\ + + false + true + $(Configuration)\ + false true @@ -649,6 +744,14 @@ true true + + true + true + + + true + true + true true @@ -701,6 +804,10 @@ true true + + true + true + true true @@ -768,6 +875,50 @@ "$(OutDir)\etl.exe" + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_CPP20_ENABLED;%(PreprocessorDefinitions) + ../../../unittest-cpp/;../../include;../../test + + + true + stdcpp20 + EditAndContinue + + + Console + true + + + "$(OutDir)\etl.exe" + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;ETL_CPP20_ENABLED;ETL_NO_STL;%(PreprocessorDefinitions) + ../../../unittest-cpp/;../../include;../../test + + + true + stdcpp20 + EditAndContinue + + + Console + true + + + "$(OutDir)\etl.exe" + + @@ -1027,6 +1178,30 @@ "$(OutDir)etl.exe" + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;__clang__;ETL_CPP20_ENABLED;%(PreprocessorDefinitions) + ../../../unittest-cpp/;../../include;../../test + + + false + stdcpp20 + false + ProgramDatabase + -Wno-self-assign /Zc:__cplusplus %(AdditionalOptions) + + + Console + false + + + "$(OutDir)etl.exe" + + @@ -1192,6 +1367,48 @@ $(OutDir)\etl.exe + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + @@ -1444,6 +1661,27 @@ $(OutDir)\etl.exe + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ../../unittest-cpp/UnitTest++/;../../include/etl;../../test + + + false + stdcpp14 + + + Console + true + + + $(OutDir)\etl.exe + + @@ -1720,6 +1958,7 @@ + @@ -2055,6 +2294,7 @@ true true + true true true true @@ -2065,6 +2305,8 @@ true true true + true + true true true true @@ -2079,6 +2321,7 @@ true true + true true true true @@ -2089,6 +2332,8 @@ true true true + true + true true true true @@ -2103,6 +2348,7 @@ true true + true true true true @@ -2113,6 +2359,8 @@ true true true + true + true true true true @@ -2127,6 +2375,7 @@ true true + true true true true @@ -2137,6 +2386,8 @@ true true true + true + true true true true @@ -2151,6 +2402,7 @@ true true + true true true true @@ -2161,6 +2413,8 @@ true true true + true + true true true true @@ -2175,6 +2429,7 @@ true true + true true true true @@ -2185,6 +2440,8 @@ true true true + true + true true true true @@ -2199,6 +2456,7 @@ true true + true true true true @@ -2209,6 +2467,8 @@ true true true + true + true true true true @@ -2223,6 +2483,7 @@ true true + true true true true @@ -2233,6 +2494,8 @@ true true true + true + true true true true @@ -2247,6 +2510,7 @@ true true + true true true true @@ -2257,6 +2521,8 @@ true true true + true + true true true true @@ -2271,6 +2537,7 @@ true true + true true true true @@ -2281,6 +2548,8 @@ true true true + true + true true true true @@ -2295,6 +2564,7 @@ true true + true true true true @@ -2305,6 +2575,8 @@ true true true + true + true true true true @@ -2318,6 +2590,8 @@ true + true + true true true true @@ -2328,6 +2602,7 @@ true true true + true true true true @@ -2337,9 +2612,13 @@ true true + + true + true true + true true true true @@ -2350,6 +2629,8 @@ true true true + true + true true true true @@ -2364,6 +2645,7 @@ true true + true true true true @@ -2374,6 +2656,8 @@ true true true + true + true true true true @@ -2388,6 +2672,7 @@ true true + true true true true @@ -2398,6 +2683,8 @@ true true true + true + true true true true @@ -2412,6 +2699,7 @@ true true + true true true true @@ -2422,6 +2710,8 @@ true true true + true + true true true true @@ -2436,6 +2726,7 @@ true true + true true true true @@ -2446,6 +2737,8 @@ true true true + true + true true true true @@ -2459,12 +2752,15 @@ true + true + true true true true true true true + true true true true @@ -2480,6 +2776,7 @@ true true + true true true true @@ -2490,6 +2787,8 @@ true true true + true + true true true true @@ -2504,6 +2803,7 @@ true true + true true true true @@ -2514,6 +2814,8 @@ true true true + true + true true true true @@ -2528,6 +2830,7 @@ true true + true true true true @@ -2538,6 +2841,8 @@ true true true + true + true true true true @@ -2551,12 +2856,15 @@ true + true + true true true true true true true + true true true true @@ -2572,6 +2880,7 @@ true true + true true true true @@ -2582,6 +2891,8 @@ true true true + true + true true true true @@ -2596,6 +2907,7 @@ true true + true true true true @@ -2606,6 +2918,8 @@ true true true + true + true true true true @@ -2620,6 +2934,7 @@ true true + true true true true @@ -2630,6 +2945,8 @@ true true true + true + true true true true @@ -2644,6 +2961,7 @@ true true + true true true true @@ -2654,6 +2972,8 @@ true true true + true + true true true true @@ -2668,6 +2988,7 @@ true true + true true true true @@ -2678,6 +2999,8 @@ true true true + true + true true true true @@ -2692,6 +3015,7 @@ true true + true true true true @@ -2702,6 +3026,8 @@ true true true + true + true true true true @@ -2716,6 +3042,7 @@ true true + true true true true @@ -2726,6 +3053,8 @@ true true true + true + true true true true @@ -2740,6 +3069,7 @@ true true + true true true true @@ -2750,6 +3080,8 @@ true true true + true + true true true true @@ -2764,6 +3096,7 @@ true true + true true true true @@ -2774,6 +3107,8 @@ true true true + true + true true true true @@ -2788,6 +3123,7 @@ true true + true true true true @@ -2798,6 +3134,8 @@ true true true + true + true true true true @@ -2812,6 +3150,7 @@ true true + true true true true @@ -2822,6 +3161,8 @@ true true true + true + true true true true @@ -2836,6 +3177,7 @@ true true + true true true true @@ -2846,6 +3188,8 @@ true true true + true + true true true true @@ -2860,6 +3204,7 @@ true true + true true true true @@ -2870,6 +3215,8 @@ true true true + true + true true true true @@ -2884,6 +3231,7 @@ true true + true true true true @@ -2894,6 +3242,8 @@ true true true + true + true true true true @@ -2908,6 +3258,7 @@ true true + true true true true @@ -2918,6 +3269,8 @@ true true true + true + true true true true @@ -2932,6 +3285,7 @@ true true + true true true true @@ -2942,6 +3296,8 @@ true true true + true + true true true true @@ -2956,6 +3312,7 @@ true true + true true true true @@ -2966,6 +3323,8 @@ true true true + true + true true true true @@ -2980,6 +3339,7 @@ true true + true true true true @@ -2990,6 +3350,8 @@ true true true + true + true true true true @@ -3004,6 +3366,7 @@ true true + true true true true @@ -3014,6 +3377,8 @@ true true true + true + true true true true @@ -3028,6 +3393,7 @@ true true + true true true true @@ -3038,6 +3404,8 @@ true true true + true + true true true true @@ -3052,6 +3420,7 @@ true true + true true true true @@ -3062,6 +3431,8 @@ true true true + true + true true true true @@ -3076,6 +3447,7 @@ true true + true true true true @@ -3086,6 +3458,8 @@ true true true + true + true true true true @@ -3100,6 +3474,7 @@ true true + true true true true @@ -3110,6 +3485,8 @@ true true true + true + true true true true @@ -3124,6 +3501,7 @@ true true + true true true true @@ -3134,6 +3512,8 @@ true true true + true + true true true true @@ -3148,6 +3528,7 @@ true true + true true true true @@ -3158,6 +3539,8 @@ true true true + true + true true true true @@ -3172,6 +3555,7 @@ true true + true true true true @@ -3182,6 +3566,8 @@ true true true + true + true true true true @@ -3196,6 +3582,7 @@ true true + true true true true @@ -3206,6 +3593,8 @@ true true true + true + true true true true @@ -3220,6 +3609,7 @@ true true + true true true true @@ -3230,6 +3620,8 @@ true true true + true + true true true true @@ -3244,6 +3636,7 @@ true true + true true true true @@ -3254,6 +3647,8 @@ true true true + true + true true true true @@ -3268,6 +3663,7 @@ true true + true true true true @@ -3278,6 +3674,8 @@ true true true + true + true true true true @@ -3292,6 +3690,7 @@ true true + true true true true @@ -3302,6 +3701,8 @@ true true true + true + true true true true @@ -3316,6 +3717,7 @@ true true + true true true true @@ -3326,6 +3728,8 @@ true true true + true + true true true true @@ -3340,6 +3744,7 @@ true true + true true true true @@ -3350,6 +3755,8 @@ true true true + true + true true true true @@ -3364,6 +3771,7 @@ true true + true true true true @@ -3374,6 +3782,8 @@ true true true + true + true true true true @@ -3388,6 +3798,7 @@ true true + true true true true @@ -3398,6 +3809,8 @@ true true true + true + true true true true @@ -3412,6 +3825,7 @@ true true + true true true true @@ -3422,6 +3836,8 @@ true true true + true + true true true true @@ -3436,6 +3852,7 @@ true true + true true true true @@ -3446,6 +3863,8 @@ true true true + true + true true true true @@ -3460,6 +3879,7 @@ true true + true true true true @@ -3470,6 +3890,8 @@ true true true + true + true true true true @@ -3484,6 +3906,7 @@ true true + true true true true @@ -3494,6 +3917,8 @@ true true true + true + true true true true @@ -3508,6 +3933,7 @@ true true + true true true true @@ -3518,6 +3944,8 @@ true true true + true + true true true true @@ -3532,6 +3960,7 @@ true true + true true true true @@ -3542,6 +3971,8 @@ true true true + true + true true true true @@ -3556,6 +3987,7 @@ true true + true true true true @@ -3566,6 +3998,8 @@ true true true + true + true true true true @@ -3580,6 +4014,7 @@ true true + true true true true @@ -3590,6 +4025,8 @@ true true true + true + true true true true @@ -3604,6 +4041,7 @@ true true + true true true true @@ -3614,6 +4052,8 @@ true true true + true + true true true true @@ -3628,6 +4068,7 @@ true true + true true true true @@ -3638,6 +4079,8 @@ true true true + true + true true true true @@ -3652,6 +4095,7 @@ true true + true true true true @@ -3662,6 +4106,8 @@ true true true + true + true true true true @@ -3676,6 +4122,7 @@ true true + true true true true @@ -3686,6 +4133,8 @@ true true true + true + true true true true @@ -3700,6 +4149,7 @@ true true + true true true true @@ -3710,6 +4160,8 @@ true true true + true + true true true true @@ -3724,6 +4176,7 @@ true true + true true true true @@ -3734,6 +4187,8 @@ true true true + true + true true true true @@ -3748,6 +4203,7 @@ true true + true true true true @@ -3758,6 +4214,8 @@ true true true + true + true true true true @@ -3772,6 +4230,7 @@ true true + true true true true @@ -3782,6 +4241,8 @@ true true true + true + true true true true @@ -3796,6 +4257,7 @@ true true + true true true true @@ -3806,6 +4268,8 @@ true true true + true + true true true true @@ -3820,6 +4284,7 @@ true true + true true true true @@ -3830,6 +4295,8 @@ true true true + true + true true true true @@ -3844,6 +4311,7 @@ true true + true true true true @@ -3854,6 +4322,8 @@ true true true + true + true true true true @@ -3868,6 +4338,7 @@ true true + true true true true @@ -3878,6 +4349,8 @@ true true true + true + true true true true @@ -3892,6 +4365,7 @@ true true + true true true true @@ -3902,6 +4376,8 @@ true true true + true + true true true true @@ -3916,6 +4392,7 @@ true true + true true true true @@ -3926,6 +4403,8 @@ true true true + true + true true true true @@ -3940,6 +4419,7 @@ true true + true true true true @@ -3950,6 +4430,8 @@ true true true + true + true true true true @@ -3964,6 +4446,7 @@ true true + true true true true @@ -3974,6 +4457,8 @@ true true true + true + true true true true @@ -3988,6 +4473,7 @@ true true + true true true true @@ -3998,6 +4484,8 @@ true true true + true + true true true true @@ -4012,6 +4500,7 @@ true true + true true true true @@ -4022,6 +4511,8 @@ true true true + true + true true true true @@ -4036,6 +4527,7 @@ true true + true true true true @@ -4046,6 +4538,8 @@ true true true + true + true true true true @@ -4060,6 +4554,7 @@ true true + true true true true @@ -4070,6 +4565,8 @@ true true true + true + true true true true @@ -4084,6 +4581,7 @@ true true + true true true true @@ -4094,6 +4592,8 @@ true true true + true + true true true true @@ -4108,6 +4608,7 @@ true true + true true true true @@ -4118,6 +4619,8 @@ true true true + true + true true true true @@ -4132,6 +4635,7 @@ true true + true true true true @@ -4142,6 +4646,8 @@ true true true + true + true true true true @@ -4156,6 +4662,7 @@ true true + true true true true @@ -4166,6 +4673,8 @@ true true true + true + true true true true @@ -4180,6 +4689,7 @@ true true + true true true true @@ -4190,6 +4700,8 @@ true true true + true + true true true true @@ -4204,6 +4716,7 @@ true true + true true true true @@ -4214,6 +4727,8 @@ true true true + true + true true true true @@ -4228,6 +4743,7 @@ true true + true true true true @@ -4238,6 +4754,8 @@ true true true + true + true true true true @@ -4252,6 +4770,7 @@ true true + true true true true @@ -4262,6 +4781,8 @@ true true true + true + true true true true @@ -4276,6 +4797,7 @@ true true + true true true true @@ -4286,6 +4808,8 @@ true true true + true + true true true true @@ -4300,6 +4824,7 @@ true true + true true true true @@ -4310,6 +4835,8 @@ true true true + true + true true true true @@ -4324,6 +4851,7 @@ true true + true true true true @@ -4334,6 +4862,8 @@ true true true + true + true true true true @@ -4348,6 +4878,7 @@ true true + true true true true @@ -4358,6 +4889,8 @@ true true true + true + true true true true @@ -4372,6 +4905,7 @@ true true + true true true true @@ -4382,6 +4916,8 @@ true true true + true + true true true true @@ -4396,6 +4932,7 @@ true true + true true true true @@ -4406,6 +4943,8 @@ true true true + true + true true true true @@ -4420,6 +4959,7 @@ true true + true true true true @@ -4430,6 +4970,8 @@ true true true + true + true true true true @@ -4444,6 +4986,7 @@ true true + true true true true @@ -4454,6 +4997,8 @@ true true true + true + true true true true @@ -4468,6 +5013,7 @@ true true + true true true true @@ -4478,6 +5024,8 @@ true true true + true + true true true true @@ -4492,6 +5040,7 @@ true true + true true true true @@ -4502,6 +5051,8 @@ true true true + true + true true true true @@ -4516,6 +5067,7 @@ true true + true true true true @@ -4526,6 +5078,8 @@ true true true + true + true true true true @@ -4540,6 +5094,7 @@ true true + true true true true @@ -4550,6 +5105,8 @@ true true true + true + true true true true @@ -4564,6 +5121,7 @@ true true + true true true true @@ -4574,6 +5132,8 @@ true true true + true + true true true true @@ -4588,6 +5148,7 @@ true true + true true true true @@ -4598,6 +5159,8 @@ true true true + true + true true true true @@ -4612,6 +5175,7 @@ true true + true true true true @@ -4622,6 +5186,8 @@ true true true + true + true true true true @@ -4636,6 +5202,7 @@ true true + true true true true @@ -4646,6 +5213,8 @@ true true true + true + true true true true @@ -4660,6 +5229,7 @@ true true + true true true true @@ -4670,6 +5240,8 @@ true true true + true + true true true true @@ -4684,6 +5256,7 @@ true true + true true true true @@ -4694,6 +5267,8 @@ true true true + true + true true true true @@ -4708,6 +5283,7 @@ true true + true true true true @@ -4718,6 +5294,8 @@ true true true + true + true true true true @@ -4732,6 +5310,7 @@ true true + true true true true @@ -4742,6 +5321,8 @@ true true true + true + true true true true @@ -4756,6 +5337,7 @@ true true + true true true true @@ -4766,6 +5348,8 @@ true true true + true + true true true true @@ -4780,6 +5364,7 @@ true true + true true true true @@ -4790,6 +5375,8 @@ true true true + true + true true true true @@ -4804,6 +5391,7 @@ true true + true true true true @@ -4814,6 +5402,8 @@ true true true + true + true true true true @@ -4828,6 +5418,7 @@ true true + true true true true @@ -4838,6 +5429,8 @@ true true true + true + true true true true @@ -4852,6 +5445,7 @@ true true + true true true true @@ -4862,6 +5456,8 @@ true true true + true + true true true true @@ -4876,6 +5472,7 @@ true true + true true true true @@ -4886,6 +5483,8 @@ true true true + true + true true true true @@ -4900,6 +5499,7 @@ true true + true true true true @@ -4910,6 +5510,8 @@ true true true + true + true true true true @@ -4924,6 +5526,7 @@ true true + true true true true @@ -4934,6 +5537,8 @@ true true true + true + true true true true @@ -4948,6 +5553,7 @@ true true + true true true true @@ -4958,6 +5564,8 @@ true true true + true + true true true true @@ -4972,6 +5580,7 @@ true true + true true true true @@ -4982,6 +5591,8 @@ true true true + true + true true true true @@ -4996,6 +5607,7 @@ true true + true true true true @@ -5006,6 +5618,8 @@ true true true + true + true true true true @@ -5020,6 +5634,7 @@ true true + true true true true @@ -5030,6 +5645,8 @@ true true true + true + true true true true @@ -5044,6 +5661,7 @@ true true + true true true true @@ -5054,6 +5672,8 @@ true true true + true + true true true true @@ -5068,6 +5688,7 @@ true true + true true true true @@ -5078,6 +5699,8 @@ true true true + true + true true true true @@ -5092,6 +5715,7 @@ true true + true true true true @@ -5102,6 +5726,8 @@ true true true + true + true true true true @@ -5116,6 +5742,7 @@ true true + true true true true @@ -5126,6 +5753,8 @@ true true true + true + true true true true @@ -5140,6 +5769,7 @@ true true + true true true true @@ -5150,6 +5780,8 @@ true true true + true + true true true true @@ -5164,6 +5796,7 @@ true true + true true true true @@ -5174,6 +5807,8 @@ true true true + true + true true true true @@ -5188,6 +5823,7 @@ true true + true true true true @@ -5198,6 +5834,8 @@ true true true + true + true true true true @@ -5212,6 +5850,7 @@ true true + true true true true @@ -5222,6 +5861,8 @@ true true true + true + true true true true @@ -5236,6 +5877,7 @@ true true + true true true true @@ -5246,6 +5888,8 @@ true true true + true + true true true true @@ -5260,6 +5904,7 @@ true true + true true true true @@ -5270,6 +5915,8 @@ true true true + true + true true true true @@ -5284,6 +5931,7 @@ true true + true true true true @@ -5294,6 +5942,8 @@ true true true + true + true true true true @@ -5308,6 +5958,7 @@ true true + true true true true @@ -5318,6 +5969,8 @@ true true true + true + true true true true @@ -5332,6 +5985,7 @@ true true + true true true true @@ -5342,6 +5996,8 @@ true true true + true + true true true true @@ -5356,6 +6012,7 @@ true true + true true true true @@ -5366,6 +6023,8 @@ true true true + true + true true true true @@ -5380,6 +6039,7 @@ true true + true true true true @@ -5390,6 +6050,8 @@ true true true + true + true true true true @@ -5404,6 +6066,7 @@ true true + true true true true @@ -5414,6 +6077,8 @@ true true true + true + true true true true @@ -5428,6 +6093,7 @@ true true + true true true true @@ -5438,6 +6104,8 @@ true true true + true + true true true true @@ -5451,12 +6119,15 @@ true + true + true true true true true true true + true true true true @@ -5472,6 +6143,7 @@ true true + true true true true @@ -5482,6 +6154,8 @@ true true true + true + true true true true @@ -5496,6 +6170,7 @@ true true + true true true true @@ -5506,6 +6181,8 @@ true true true + true + true true true true @@ -5520,6 +6197,7 @@ true true + true true true true @@ -5530,6 +6208,8 @@ true true true + true + true true true true @@ -5544,6 +6224,7 @@ true true + true true true true @@ -5554,6 +6235,8 @@ true true true + true + true true true true @@ -5568,6 +6251,7 @@ true true + true true true true @@ -5578,6 +6262,8 @@ true true true + true + true true true true @@ -5591,12 +6277,15 @@ true + true + true true true true true true true + true true true true @@ -5611,12 +6300,15 @@ true + true + true true true true true true true + true true true true @@ -5632,6 +6324,7 @@ true true + true true true true @@ -5642,6 +6335,8 @@ true true true + true + true true true true @@ -5656,6 +6351,7 @@ true true + true true true true @@ -5666,6 +6362,8 @@ true true true + true + true true true true @@ -5680,6 +6378,7 @@ true true + true true true true @@ -5690,6 +6389,8 @@ true true true + true + true true true true @@ -5703,12 +6404,15 @@ true + true + true true true true true true true + true true true true @@ -5724,6 +6428,7 @@ true true + true true true true @@ -5734,6 +6439,8 @@ true true true + true + true true true true @@ -5748,6 +6455,7 @@ true true + true true true true @@ -5758,6 +6466,8 @@ true true true + true + true true true true @@ -5772,6 +6482,7 @@ true true + true true true true @@ -5782,6 +6493,8 @@ true true true + true + true true true true @@ -5796,6 +6509,7 @@ true true + true true true true @@ -5806,6 +6520,8 @@ true true true + true + true true true true @@ -5820,6 +6536,7 @@ true true + true true true true @@ -5830,6 +6547,8 @@ true true true + true + true true true true @@ -5844,6 +6563,7 @@ true true + true true true true @@ -5854,6 +6574,8 @@ true true true + true + true true true true @@ -5868,6 +6590,7 @@ true true + true true true true @@ -5878,6 +6601,8 @@ true true true + true + true true true true @@ -5892,6 +6617,7 @@ true true + true true true true @@ -5902,6 +6628,8 @@ true true true + true + true true true true @@ -5916,6 +6644,7 @@ true true + true true true true @@ -5926,6 +6655,8 @@ true true true + true + true true true true @@ -5940,6 +6671,7 @@ true true + true true true true @@ -5950,6 +6682,8 @@ true true true + true + true true true true @@ -5964,6 +6698,7 @@ true true + true true true true @@ -5974,6 +6709,8 @@ true true true + true + true true true true @@ -5988,6 +6725,7 @@ true true + true true true true @@ -5998,6 +6736,8 @@ true true true + true + true true true true @@ -6012,6 +6752,7 @@ true true + true true true true @@ -6022,6 +6763,8 @@ true true true + true + true true true true @@ -6036,6 +6779,7 @@ true true + true true true true @@ -6046,6 +6790,8 @@ true true true + true + true true true true @@ -6060,6 +6806,7 @@ true true + true true true true @@ -6070,6 +6817,8 @@ true true true + true + true true true true @@ -6084,6 +6833,7 @@ true true + true true true true @@ -6094,6 +6844,8 @@ true true true + true + true true true true @@ -6108,6 +6860,7 @@ true true + true true true true @@ -6118,6 +6871,8 @@ true true true + true + true true true true @@ -6132,6 +6887,7 @@ true true + true true true true @@ -6142,6 +6898,8 @@ true true true + true + true true true true @@ -6156,6 +6914,7 @@ true true + true true true true @@ -6166,6 +6925,8 @@ true true true + true + true true true true @@ -6180,6 +6941,7 @@ true true + true true true true @@ -6190,6 +6952,8 @@ true true true + true + true true true true @@ -6204,6 +6968,7 @@ true true + true true true true @@ -6214,6 +6979,8 @@ true true true + true + true true true true @@ -6228,6 +6995,7 @@ true true + true true true true @@ -6238,6 +7006,8 @@ true true true + true + true true true true @@ -6252,6 +7022,7 @@ true true + true true true true @@ -6262,6 +7033,8 @@ true true true + true + true true true true @@ -6276,6 +7049,7 @@ true true + true true true true @@ -6286,6 +7060,8 @@ true true true + true + true true true true @@ -6300,6 +7076,7 @@ true true + true true true true @@ -6310,6 +7087,8 @@ true true true + true + true true true true @@ -6324,6 +7103,7 @@ true true + true true true true @@ -6334,6 +7114,8 @@ true true true + true + true true true true @@ -6348,6 +7130,7 @@ true true + true true true true @@ -6358,6 +7141,8 @@ true true true + true + true true true true @@ -6372,6 +7157,7 @@ true true + true true true true @@ -6382,6 +7168,8 @@ true true true + true + true true true true @@ -6396,6 +7184,7 @@ true true + true true true true @@ -6406,6 +7195,8 @@ true true true + true + true true true true @@ -6420,6 +7211,7 @@ true true + true true true true @@ -6430,6 +7222,8 @@ true true true + true + true true true true @@ -6444,6 +7238,7 @@ true true + true true true true @@ -6454,6 +7249,8 @@ true true true + true + true true true true @@ -6468,6 +7265,7 @@ true true + true true true true @@ -6478,6 +7276,8 @@ true true true + true + true true true true @@ -6492,6 +7292,7 @@ true true + true true true true @@ -6502,6 +7303,8 @@ true true true + true + true true true true @@ -6516,6 +7319,7 @@ true true + true true true true @@ -6526,6 +7330,8 @@ true true true + true + true true true true @@ -6540,6 +7346,7 @@ true true + true true true true @@ -6550,6 +7357,8 @@ true true true + true + true true true true @@ -6564,6 +7373,7 @@ true true + true true true true @@ -6574,6 +7384,8 @@ true true true + true + true true true true @@ -6588,6 +7400,7 @@ true true + true true true true @@ -6598,6 +7411,8 @@ true true true + true + true true true true @@ -6612,6 +7427,7 @@ true true + true true true true @@ -6622,6 +7438,8 @@ true true true + true + true true true true @@ -6636,6 +7454,7 @@ true true + true true true true @@ -6646,6 +7465,8 @@ true true true + true + true true true true @@ -6660,6 +7481,7 @@ true true + true true true true @@ -6670,6 +7492,8 @@ true true true + true + true true true true @@ -6684,6 +7508,7 @@ true true + true true true true @@ -6694,6 +7519,8 @@ true true true + true + true true true true @@ -6708,6 +7535,7 @@ true true + true true true true @@ -6718,6 +7546,8 @@ true true true + true + true true true true @@ -6732,6 +7562,7 @@ true true + true true true true @@ -6742,6 +7573,8 @@ true true true + true + true true true true @@ -6756,6 +7589,7 @@ true true + true true true true @@ -6766,6 +7600,8 @@ true true true + true + true true true true @@ -6780,6 +7616,7 @@ true true + true true true true @@ -6790,6 +7627,8 @@ true true true + true + true true true true @@ -6804,6 +7643,7 @@ true true + true true true true @@ -6814,6 +7654,8 @@ true true true + true + true true true true @@ -6828,6 +7670,7 @@ true true + true true true true @@ -6838,6 +7681,8 @@ true true true + true + true true true true @@ -6852,6 +7697,7 @@ true true + true true true true @@ -6862,6 +7708,8 @@ true true true + true + true true true true @@ -6876,6 +7724,7 @@ true true + true true true true @@ -6886,6 +7735,8 @@ true true true + true + true true true true @@ -6900,6 +7751,7 @@ true true + true true true true @@ -6910,6 +7762,8 @@ true true true + true + true true true true @@ -6924,6 +7778,7 @@ true true + true true true true @@ -6934,6 +7789,8 @@ true true true + true + true true true true @@ -6948,6 +7805,7 @@ true true + true true true true @@ -6958,6 +7816,8 @@ true true true + true + true true true true @@ -6972,6 +7832,7 @@ true true + true true true true @@ -6982,6 +7843,8 @@ true true true + true + true true true true @@ -6996,6 +7859,7 @@ true true + true true true true @@ -7006,6 +7870,8 @@ true true true + true + true true true true @@ -7020,6 +7886,7 @@ true true + true true true true @@ -7030,6 +7897,8 @@ true true true + true + true true true true @@ -7044,6 +7913,7 @@ true true + true true true true @@ -7054,6 +7924,8 @@ true true true + true + true true true true @@ -7068,6 +7940,7 @@ true true + true true true true @@ -7078,6 +7951,8 @@ true true true + true + true true true true @@ -7092,6 +7967,7 @@ true true + true true true true @@ -7102,6 +7978,8 @@ true true true + true + true true true true @@ -7116,6 +7994,7 @@ true true + true true true true @@ -7126,6 +8005,8 @@ true true true + true + true true true true @@ -7140,6 +8021,7 @@ true true + true true true true @@ -7150,6 +8032,8 @@ true true true + true + true true true true @@ -7164,6 +8048,7 @@ true true + true true true true @@ -7174,6 +8059,8 @@ true true true + true + true true true true @@ -7188,6 +8075,7 @@ true true + true true true true @@ -7198,6 +8086,8 @@ true true true + true + true true true true @@ -7212,6 +8102,7 @@ true true + true true true true @@ -7222,6 +8113,8 @@ true true true + true + true true true true @@ -7236,6 +8129,7 @@ true true + true true true true @@ -7246,6 +8140,8 @@ true true true + true + true true true true @@ -7260,6 +8156,7 @@ true true + true true true true @@ -7270,6 +8167,8 @@ true true true + true + true true true true @@ -7284,6 +8183,7 @@ true true + true true true true @@ -7294,6 +8194,8 @@ true true true + true + true true true true @@ -7308,6 +8210,7 @@ true true + true true true true @@ -7318,6 +8221,8 @@ true true true + true + true true true true @@ -7332,6 +8237,7 @@ true true + true true true true @@ -7342,6 +8248,8 @@ true true true + true + true true true true @@ -7353,9 +8261,13 @@ true true + + true + true true + true true true true @@ -7366,6 +8278,8 @@ true true true + true + true true true true @@ -7380,6 +8294,7 @@ true true + true true true true @@ -7390,6 +8305,8 @@ true true true + true + true true true true @@ -7404,6 +8321,7 @@ true true + true true true true @@ -7414,6 +8332,8 @@ true true true + true + true true true true @@ -7428,6 +8348,7 @@ true true + true true true true @@ -7438,6 +8359,8 @@ true true true + true + true true true true @@ -7452,6 +8375,7 @@ true true + true true true true @@ -7462,6 +8386,8 @@ true true true + true + true true true true @@ -7476,6 +8402,7 @@ true true + true true true true @@ -7486,6 +8413,8 @@ true true true + true + true true true true @@ -7500,6 +8429,7 @@ true true + true true true true @@ -7510,6 +8440,8 @@ true true true + true + true true true true @@ -7524,6 +8456,7 @@ true true + true true true true @@ -7534,6 +8467,8 @@ true true true + true + true true true true @@ -7548,6 +8483,7 @@ true true + true true true true @@ -7558,6 +8494,8 @@ true true true + true + true true true true @@ -7572,6 +8510,7 @@ true true + true true true true @@ -7582,6 +8521,8 @@ true true true + true + true true true true @@ -7596,6 +8537,7 @@ true true + true true true true @@ -7606,6 +8548,8 @@ true true true + true + true true true true @@ -7620,6 +8564,7 @@ true true + true true true true @@ -7630,6 +8575,8 @@ true true true + true + true true true true @@ -7644,6 +8591,7 @@ true true + true true true true @@ -7654,6 +8602,8 @@ true true true + true + true true true true @@ -7668,6 +8618,7 @@ true true + true true true true @@ -7678,6 +8629,8 @@ true true true + true + true true true true @@ -7692,6 +8645,7 @@ true true + true true true true @@ -7702,6 +8656,8 @@ true true true + true + true true true true @@ -7716,6 +8672,7 @@ true true + true true true true @@ -7726,6 +8683,8 @@ true true true + true + true true true true @@ -7740,6 +8699,7 @@ true true + true true true true @@ -7750,6 +8710,8 @@ true true true + true + true true true true @@ -7764,6 +8726,7 @@ true true + true true true true @@ -7774,6 +8737,8 @@ true true true + true + true true true true @@ -7789,6 +8754,7 @@ + @@ -7899,6 +8865,8 @@ false false false + false + false false false false @@ -7913,12 +8881,15 @@ false false false + false false false false false false false + false + false false false false @@ -7933,6 +8904,7 @@ false false false + false false false false @@ -7958,6 +8930,8 @@ false + false + false false false false @@ -7972,12 +8946,15 @@ false false false + false false false false false false false + false + false false false false @@ -7992,6 +8969,7 @@ false false false + false false false false @@ -8012,6 +8990,8 @@ false + false + false false false false @@ -8026,12 +9006,15 @@ false false false + false false false false false false false + false + false false false false @@ -8046,6 +9029,7 @@ false false false + false false false false @@ -8056,6 +9040,8 @@ false + false + false false false false @@ -8070,12 +9056,15 @@ false false false + false false false false false false false + false + false false false false @@ -8090,6 +9079,7 @@ false false false + false false false false @@ -8100,6 +9090,8 @@ false + false + false false false false @@ -8114,12 +9106,15 @@ false false false + false false false false false false false + false + false false false false @@ -8134,6 +9129,7 @@ false false false + false false false false @@ -8144,6 +9140,8 @@ false + false + false false false false @@ -8158,12 +9156,15 @@ false false false + false false false false false false false + false + false false false false @@ -8178,6 +9179,7 @@ false false false + false false false false @@ -8188,6 +9190,8 @@ false + false + false false false false @@ -8202,12 +9206,15 @@ false false false + false false false false false false false + false + false false false false @@ -8222,6 +9229,7 @@ false false false + false false false false @@ -8237,6 +9245,8 @@ false + false + false false false false @@ -8251,12 +9261,15 @@ false false false + false false false false false false false + false + false false false false @@ -8271,6 +9284,7 @@ false false false + false false false false @@ -8285,6 +9299,8 @@ true true false + false + false false false false @@ -8299,12 +9315,15 @@ false false false + false false false false false false false + false + false false false false @@ -8319,6 +9338,7 @@ false false false + false false false false @@ -8341,6 +9361,8 @@ false + false + false false false false @@ -8355,12 +9377,15 @@ false false false + false false false false false false false + false + false false false false @@ -8375,6 +9400,7 @@ false false false + false false false false diff --git a/test/vs2019/etl.vcxproj.filters b/test/vs2019/etl.vcxproj.filters index 1550674f..b8d54e47 100644 --- a/test/vs2019/etl.vcxproj.filters +++ b/test/vs2019/etl.vcxproj.filters @@ -1173,6 +1173,9 @@ ETL\Frameworks + + ETL\Utilities + @@ -3083,6 +3086,15 @@ Tests + + Tests + + + Tests\Sanity Checks + + + Tests\Sanity Checks + Tests @@ -3233,4 +3245,4 @@ Resource Files - \ No newline at end of file +