Changes to alternate STL limits.h for ARM5 compiler compatibility

This commit is contained in:
John Wellbelove 2019-12-11 12:57:50 +00:00
parent 3649f839f5
commit 703fe0f92b
5 changed files with 42 additions and 125 deletions

View File

@ -51,18 +51,18 @@ namespace etlstd
enum float_round_style
{
round_indeterminate = -1,
round_toward_zero = 0,
round_to_nearest = 1,
round_toward_infinity = 2,
round_indeterminate = -1,
round_toward_zero = 0,
round_to_nearest = 1,
round_toward_infinity = 2,
round_toward_neg_infinity = 3,
};
enum float_denorm_style
{
denorm_indeterminate = -1,
denorm_absent = 0,
denorm_present = 1
denorm_absent = 0,
denorm_present = 1
};
//***************************************************************************
@ -76,66 +76,42 @@ namespace etlstd
static ETL_CONST int max_digits10 = 0;
static ETL_CONST bool is_integer = true;
static ETL_CONST bool is_exact = true;
static ETL_CONST bool is_exact = true;
static ETL_CONST int radix = 2;
static ETL_CONSTEXPR T epsilon() { return 0; }
static ETL_CONSTEXPR T round_error() { return 0; }
static ETL_CONST int digits = (CHAR_BIT * sizeof(T)) - (etl::is_signed<T>::value ? 1 : 0);
static ETL_CONST int digits = (CHAR_BIT * sizeof(T)) - (etl::is_signed<T>::value ? 1 : 0);
static ETL_CONST int digits10 = ETL_LOG2(digits);
static ETL_CONST bool is_signed = etl::is_signed<T>::value;
static ETL_CONST int min_exponent = 0;
static ETL_CONST int min_exponent = 0;
static ETL_CONST int min_exponent10 = 0;
static ETL_CONST int max_exponent = 0;
static ETL_CONST int max_exponent = 0;
static ETL_CONST int max_exponent10 = 0;
static ETL_CONST bool has_infinity = false;
static ETL_CONST bool has_quiet_NaN = false;
static ETL_CONST bool has_signaling_NaN = false;
static ETL_CONST bool has_infinity = false;
static ETL_CONST bool has_quiet_NaN = false;
static ETL_CONST bool has_signaling_NaN = false;
static ETL_CONST float_denorm_style has_denorm = denorm_absent;
static ETL_CONST bool has_denorm_loss = false;
static ETL_CONST bool has_denorm_loss = false;
static ETL_CONSTEXPR T infinity() { return 0; }
static ETL_CONSTEXPR T quiet_NaN() { return 0; }
static ETL_CONSTEXPR T signaling_NaN() { return 0; }
static ETL_CONSTEXPR T denorm_min() { return 0; }
static ETL_CONST bool is_iec559 = false;
static ETL_CONST bool is_iec559 = false;
static ETL_CONST bool is_bounded = true;
static ETL_CONST bool is_modulo = etl::is_unsigned<T>::value;
static ETL_CONST bool is_modulo = etl::is_unsigned<T>::value;
static ETL_CONST bool traps = false;
static ETL_CONST bool tinyness_before = false;
static ETL_CONST float_round_style round_style = round_toward_zero;
};
template <typename T> ETL_CONST bool etl_integral_type<T>::is_specialized;
template <typename T> ETL_CONST int etl_integral_type<T>::digits;
template <typename T> ETL_CONST int etl_integral_type<T>::digits10;
template <typename T> ETL_CONST int etl_integral_type<T>::max_digits10;
template <typename T> ETL_CONST bool etl_integral_type<T>::is_signed;
template <typename T> ETL_CONST bool etl_integral_type<T>::is_integer;
template <typename T> ETL_CONST bool etl_integral_type<T>::is_exact;
template <typename T> ETL_CONST int etl_integral_type<T>::radix;
template <typename T> ETL_CONST int etl_integral_type<T>::min_exponent;
template <typename T> ETL_CONST int etl_integral_type<T>::min_exponent10;
template <typename T> ETL_CONST int etl_integral_type<T>::max_exponent;
template <typename T> ETL_CONST int etl_integral_type<T>::max_exponent10;
template <typename T> ETL_CONST bool etl_integral_type<T>::has_infinity;
template <typename T> ETL_CONST bool etl_integral_type<T>::has_quiet_NaN;
template <typename T> ETL_CONST bool etl_integral_type<T>::has_signaling_NaN;
template <typename T> ETL_CONST float_denorm_style etl_integral_type<T>::has_denorm;
template <typename T> ETL_CONST bool etl_integral_type<T>::has_denorm_loss;
template <typename T> ETL_CONST bool etl_integral_type<T>::is_iec559;
template <typename T> ETL_CONST bool etl_integral_type<T>::is_bounded;
template <typename T> ETL_CONST bool etl_integral_type<T>::is_modulo;
template <typename T> ETL_CONST bool etl_integral_type<T>::traps;
template <typename T> ETL_CONST bool etl_integral_type<T>::tinyness_before;
template <typename T> ETL_CONST float_round_style etl_integral_type<T>::round_style;
//***************************************************************************
// Base for floating point types.
template <typename T>
@ -144,9 +120,9 @@ namespace etlstd
public:
static ETL_CONST bool is_specialized = true;
static ETL_CONST bool is_signed = true;
static ETL_CONST bool is_signed = true;
static ETL_CONST bool is_integer = false;
static ETL_CONST bool is_exact = false;
static ETL_CONST bool is_exact = false;
static ETL_CONST int radix = 2;
@ -170,23 +146,6 @@ namespace etlstd
static ETL_CONST float_round_style round_style = round_to_nearest;
};
template <typename T> ETL_CONST bool etl_floating_point_type<T>::is_specialized;
template <typename T> ETL_CONST bool etl_floating_point_type<T>::is_signed;
template <typename T> ETL_CONST bool etl_floating_point_type<T>::is_integer;
template <typename T> ETL_CONST bool etl_floating_point_type<T>::is_exact;
template <typename T> ETL_CONST int etl_floating_point_type<T>::radix;
template <typename T> ETL_CONST bool etl_floating_point_type<T>::has_infinity;
template <typename T> ETL_CONST bool etl_floating_point_type<T>::has_quiet_NaN;
template <typename T> ETL_CONST bool etl_floating_point_type<T>::has_signaling_NaN;
template <typename T> ETL_CONST float_denorm_style etl_floating_point_type<T>::has_denorm;
template <typename T> ETL_CONST bool etl_floating_point_type<T>::has_denorm_loss;
template <typename T> ETL_CONST bool etl_floating_point_type<T>::is_iec559;
template <typename T> ETL_CONST bool etl_floating_point_type<T>::is_bounded;
template <typename T> ETL_CONST bool etl_floating_point_type<T>::is_modulo;
template <typename T> ETL_CONST bool etl_floating_point_type<T>::traps;
template <typename T> ETL_CONST bool etl_floating_point_type<T>::tinyness_before;
template <typename T> ETL_CONST float_round_style etl_floating_point_type<T>::round_style;
//***************************************************************************
// Default
template<class T>
@ -242,30 +201,6 @@ namespace etlstd
static ETL_CONST float_round_style round_style = round_toward_zero;
};
ETL_CONST bool numeric_limits<bool>::is_specialized;
ETL_CONST int numeric_limits<bool>::digits;
ETL_CONST int numeric_limits<bool>::digits10;
ETL_CONST int numeric_limits<bool>::max_digits10;
ETL_CONST bool numeric_limits<bool>::is_signed;
ETL_CONST bool numeric_limits<bool>::is_integer;
ETL_CONST bool numeric_limits<bool>::is_exact;
ETL_CONST int numeric_limits<bool>::radix;
ETL_CONST int numeric_limits<bool>::min_exponent;
ETL_CONST int numeric_limits<bool>::min_exponent10;
ETL_CONST int numeric_limits<bool>::max_exponent;
ETL_CONST int numeric_limits<bool>::max_exponent10;
ETL_CONST bool numeric_limits<bool>::has_infinity;
ETL_CONST bool numeric_limits<bool>::has_quiet_NaN;
ETL_CONST bool numeric_limits<bool>::has_signaling_NaN;
ETL_CONST float_denorm_style numeric_limits<bool>::has_denorm;
ETL_CONST bool numeric_limits<bool>::has_denorm_loss;
ETL_CONST bool numeric_limits<bool>::is_iec559;
ETL_CONST bool numeric_limits<bool>::is_bounded;
ETL_CONST bool numeric_limits<bool>::is_modulo;
ETL_CONST bool numeric_limits<bool>::traps;
ETL_CONST bool numeric_limits<bool>::tinyness_before;
ETL_CONST float_round_style numeric_limits<bool>::round_style;
//***************************************************************************
// char
template<>
@ -273,9 +208,9 @@ namespace etlstd
{
public:
static ETL_CONSTEXPR char min() { return CHAR_MIN; }
static ETL_CONSTEXPR char max() { return CHAR_MAX; }
static ETL_CONSTEXPR char lowest() { return CHAR_MIN; }
static ETL_CONSTEXPR char min() { return char(CHAR_MIN); }
static ETL_CONSTEXPR char max() { return char(CHAR_MAX); }
static ETL_CONSTEXPR char lowest() { return char(CHAR_MIN); }
};
//***************************************************************************
@ -302,6 +237,7 @@ namespace etlstd
static ETL_CONSTEXPR signed char lowest() { return SCHAR_MIN; }
};
#if (ETL_NO_LARGE_CHAR_SUPPORT == false)
//***************************************************************************
// char16_t
template<>
@ -325,6 +261,7 @@ namespace etlstd
static ETL_CONSTEXPR char32_t max() { return UINT_LEAST32_MAX; }
static ETL_CONSTEXPR char32_t lowest() { return 0; }
};
#endif
//***************************************************************************
// wchar_t
@ -447,24 +384,16 @@ namespace etlstd
static ETL_CONSTEXPR float epsilon() { return FLT_EPSILON; }
static ETL_CONSTEXPR float denorm_min() { return FLT_MIN; }
static ETL_CONST int digits = FLT_MANT_DIG;
static ETL_CONST int digits10 = FLT_DIG;
static ETL_CONST int digits = FLT_MANT_DIG;
static ETL_CONST int digits10 = FLT_DIG;
static ETL_CONST int max_digits10 = ETL_LOG2(FLT_MANT_DIG) + 2;
static ETL_CONST int min_exponent = FLT_MIN_EXP;
static ETL_CONST int min_exponent = FLT_MIN_EXP;
static ETL_CONST int min_exponent10 = FLT_MIN_10_EXP;
static ETL_CONST int max_exponent = FLT_MAX_EXP;
static ETL_CONST int max_exponent = FLT_MAX_EXP;
static ETL_CONST int max_exponent10 = FLT_MAX_10_EXP;
};
ETL_CONST int numeric_limits<float>::digits;
ETL_CONST int numeric_limits<float>::max_digits10;
ETL_CONST int numeric_limits<float>::digits10;
ETL_CONST int numeric_limits<float>::min_exponent;
ETL_CONST int numeric_limits<float>::min_exponent10;
ETL_CONST int numeric_limits<float>::max_exponent;
ETL_CONST int numeric_limits<float>::max_exponent10;
//***************************************************************************
// double
template<>
@ -478,24 +407,16 @@ namespace etlstd
static ETL_CONSTEXPR double epsilon() { return DBL_EPSILON; }
static ETL_CONSTEXPR double denorm_min() { return DBL_MIN; }
static ETL_CONST int digits = DBL_MANT_DIG;
static ETL_CONST int digits10 = DBL_DIG;
static ETL_CONST int digits = DBL_MANT_DIG;
static ETL_CONST int digits10 = DBL_DIG;
static ETL_CONST int max_digits10 = ETL_LOG2(DBL_MANT_DIG) + 2;
static ETL_CONST int min_exponent = DBL_MIN_EXP;
static ETL_CONST int min_exponent = DBL_MIN_EXP;
static ETL_CONST int min_exponent10 = DBL_MIN_10_EXP;
static ETL_CONST int max_exponent = DBL_MAX_EXP;
static ETL_CONST int max_exponent = DBL_MAX_EXP;
static ETL_CONST int max_exponent10 = DBL_MAX_10_EXP;
};
ETL_CONST int numeric_limits<double>::digits;
ETL_CONST int numeric_limits<double>::max_digits10;
ETL_CONST int numeric_limits<double>::digits10;
ETL_CONST int numeric_limits<double>::min_exponent;
ETL_CONST int numeric_limits<double>::min_exponent10;
ETL_CONST int numeric_limits<double>::max_exponent;
ETL_CONST int numeric_limits<double>::max_exponent10;
//***************************************************************************
// long double
template<>
@ -509,23 +430,15 @@ namespace etlstd
static ETL_CONSTEXPR long double epsilon() { return LDBL_EPSILON; }
static ETL_CONSTEXPR long double denorm_min() { return LDBL_MIN; }
static ETL_CONST int digits = LDBL_MANT_DIG;
static ETL_CONST int digits10 = LDBL_DIG;
static ETL_CONST int digits = LDBL_MANT_DIG;
static ETL_CONST int digits10 = LDBL_DIG;
static ETL_CONST int max_digits10 = ETL_LOG2(LDBL_MANT_DIG) + 2;
static ETL_CONST int min_exponent = LDBL_MIN_EXP;
static ETL_CONST int min_exponent = LDBL_MIN_EXP;
static ETL_CONST int min_exponent10 = LDBL_MIN_10_EXP;
static ETL_CONST int max_exponent = LDBL_MAX_EXP;
static ETL_CONST int max_exponent = LDBL_MAX_EXP;
static ETL_CONST int max_exponent10 = LDBL_MAX_10_EXP;
};
ETL_CONST int numeric_limits<long double>::digits;
ETL_CONST int numeric_limits<long double>::max_digits10;
ETL_CONST int numeric_limits<long double>::digits10;
ETL_CONST int numeric_limits<long double>::min_exponent;
ETL_CONST int numeric_limits<long double>::min_exponent10;
ETL_CONST int numeric_limits<long double>::max_exponent;
ETL_CONST int numeric_limits<long double>::max_exponent10;
}
#endif

View File

@ -39,7 +39,7 @@ SOFTWARE.
#define ETL_VERSION_MAJOR 15
#define ETL_VERSION_MINOR 3
#define ETL_VERSION_PATCH 0
#define ETL_VERSION_PATCH 1
#define ETL_VERSION ETL_STRINGIFY(ETL_VERSION_MAJOR) "." ETL_STRINGIFY(ETL_VERSION_MINOR) "." ETL_STRINGIFY(ETL_VERSION_PATCH)
#define ETL_VERSION_W ETL_STRINGIFY(ETL_VERSION_MAJOR) L"." ETL_STRINGIFY(ETL_VERSION_MINOR) L"." ETL_STRINGIFY(ETL_VERSION_PATCH)

View File

@ -1,6 +1,6 @@
{
"name": "Embedded Template Library",
"version": "15.3.0",
"version": "15.3.1",
"authors": {
"name": "John Wellbelove",
"email": "<john.wellbelove@etlcpp.com>"

View File

@ -1,5 +1,5 @@
name=Embedded Template Library
version=15.3.0
version=15.3.1
author= John Wellbelove <john.wellbelove@etlcpp.com>
maintainer=John Wellbelove <john.wellbelove@etlcpp.com>
license=MIT

View File

@ -1,3 +1,7 @@
===============================================================================
15.3.1
Changes to alternate STL limits.h for ARM5 compiler compatibility
===============================================================================
15.3.0
Added etl::make_string_with_capacity