From bf56dcf0742bf68077e2568068de2b8a803654a5 Mon Sep 17 00:00:00 2001 From: ReneCanadian <71091648+ReneCanadian@users.noreply.github.com> Date: Tue, 30 Jul 2024 14:54:40 +0200 Subject: [PATCH 1/2] added 20 bit integral limits (#935) --- include/etl/integral_limits.h | 62 +++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/include/etl/integral_limits.h b/include/etl/integral_limits.h index f7b7c68c..f30f63a5 100644 --- a/include/etl/integral_limits.h +++ b/include/etl/integral_limits.h @@ -459,6 +459,54 @@ namespace etl template ETL_CONSTANT bool statics_char32_t::is_signed; #endif + +#ifdef ETL_20_BIT +template + struct statics___int20 + { + typedef __int20 value_type; + + static ETL_CONSTANT __int20 min = 0x80000; + static ETL_CONSTANT __int20 max = 0x7FFFF; + static ETL_CONSTANT int bits = 20; + static ETL_CONSTANT bool is_signed = true; + }; + + template + ETL_CONSTANT __int20 statics___int20::min; + + template + ETL_CONSTANT __int20 statics___int20::max; + + template + ETL_CONSTANT int statics___int20::bits; + + template + ETL_CONSTANT bool statics___int20::is_signed; + + template + struct statics_unsigned___int20 + { + typedef unsigned __int20 value_type; + + static ETL_CONSTANT unsigned __int20 min = 0; + static ETL_CONSTANT unsigned __int20 max = 0xFFFFF; + static ETL_CONSTANT int bits = 20; + static ETL_CONSTANT bool is_signed = false; + }; + + template + ETL_CONSTANT unsigned __int20 statics_unsigned___int20::min; + + template + ETL_CONSTANT unsigned __int20 statics_unsigned___int20::max; + + template + ETL_CONSTANT int statics_unsigned___int20::bits; + + template + ETL_CONSTANT bool statics_unsigned___int20::is_signed; +#endif } //*************************************************************************** @@ -556,6 +604,20 @@ namespace etl struct integral_limits : public private_integral_limits::statics_unsigned_long_long<> { }; + #ifdef ETL_20_BIT + //*************************************************************************** + ///\ingroup integral_limits + //*************************************************************************** + template <> + struct integral_limits<__int20> : public private_integral_limits::statics___int20<> + { + }; + + template <> + struct integral_limits : public private_integral_limits::statics_unsigned___int20<> + { + }; + #endif } #include "private/minmax_pop.h" From 75f2e7b392cb10f0abaa0df880c18daf33877323 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Tue, 30 Jul 2024 14:46:50 +0100 Subject: [PATCH 2/2] Added support for 20bit types for integral_limits --- include/etl/integral_limits.h | 9 +++++---- include/etl/platform.h | 11 +++++++++++ support/Release notes.txt | 36 +++++++++++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/include/etl/integral_limits.h b/include/etl/integral_limits.h index f30f63a5..8ac9aa80 100644 --- a/include/etl/integral_limits.h +++ b/include/etl/integral_limits.h @@ -460,7 +460,7 @@ namespace etl ETL_CONSTANT bool statics_char32_t::is_signed; #endif -#ifdef ETL_20_BIT +#if ETL_USING_20BIT_TYPES template struct statics___int20 { @@ -604,11 +604,12 @@ template struct integral_limits : public private_integral_limits::statics_unsigned_long_long<> { }; - #ifdef ETL_20_BIT - //*************************************************************************** + + #if ETL_USING_20BIT_TYPES + //*************************************************************************** ///\ingroup integral_limits //*************************************************************************** - template <> + template <> struct integral_limits<__int20> : public private_integral_limits::statics___int20<> { }; diff --git a/include/etl/platform.h b/include/etl/platform.h index 17c7961d..f89ede6f 100644 --- a/include/etl/platform.h +++ b/include/etl/platform.h @@ -117,6 +117,17 @@ SOFTWARE. #define ETL_8BIT_SUPPORT (CHAR_BIT == 8) // Deprecated +//************************************* +// Some targets support 20bit types. +#if defined(ETL_USE_20BIT_TYPES) + #define ETL_USING_20BIT_TYPES 1 + #define ETL_NOT_USING_20BIT_TYPES 0 +#else + #define ETL_USING_20BIT_TYPES 0 + #define ETL_NOT_USING_20BIT_TYPES 1 +#endif + + //************************************* // Helper macro for ETL_NO_64BIT_TYPES. #if defined(ETL_NO_64BIT_TYPES) diff --git a/support/Release notes.txt b/support/Release notes.txt index cc50700d..c65f3142 100644 --- a/support/Release notes.txt +++ b/support/Release notes.txt @@ -1,4 +1,40 @@ =============================================================================== +20.39.0 + +Refactored: +Breaking change. +Modified io_port classes so that they are not derived from iterator types. + Added iterator and const_iterator types. + Added iter() and citer() member functions to get an iterator. + Added &= |= ^= <<= >>= and ~ operators (only available for io_port_rw and io_port_wos types) + Added static asserts to only allow integral types. + +Fixes: +#921 unique_ptr reset +#923 Missing equality operator for class expected +#930 Unused parameter warnings +#931 Using etl::make_vector to make a vector of two pairs causes a compile error + +Features: +#918 Request for additional operator support for etl::io_port_* +#919 callback_timer: expose callback_timer_data::is_active() as icallback_timer public method +#920 Define ETL_USING_LEGACY_VARIANT as a convenience macro for code that tries to support both new and legacy variants + +Pull Requests +#909 fix c++20-compat false positive +#914 Fix doc comment for pool::allocate() +#924 Add an etl::nullptr_t type to +#925 Add equality operators for class expected +#926 Fix issue #923 equality operator for class expected +#927 Fix missing partial specialisation equal operators +#928 Add missing swap implementations for expected +#929 Fix run-tests.sh script +#932 Fix issue #931 Using etl::make_vector to make a vector of two pairs causes a compile error +#934 Fixes compiler detection with Wundef +#935 Added 20 bit integral limits (MSP430 devices) + New configuration macro, ETL_USE_20BIT_TYPES, which controls the definition of ETL_USING_20BIT_TYPES and ETL_NOT_USING_20BIT_TYPES. + +=============================================================================== 20.38.17 #895 Removed std algorithm calls from algorithm.h