Improvements detection of features, part 12.

This commit is contained in:
HedgehogInTheCPP 2026-08-21 23:10:50 +03:00
parent 57cb772715
commit 677cfe8425
5 changed files with 8 additions and 10 deletions

View File

@ -19,7 +19,7 @@
namespace fast_float {
template <typename UC>
fastfloat_really_inline constexpr bool has_simd_opt() noexcept {
fastfloat_really_inline FASTFLOAT_CONSTEVAL bool has_simd_opt() noexcept {
#ifdef FASTFLOAT_USE_SIMD
return std::is_same<UC, char16_t>::value;
#else

View File

@ -212,13 +212,11 @@ fastfloat_really_inline FASTFLOAT_CONSTEXPR20 limb
scalar_add(limb x, limb y, bool &overflow) noexcept {
limb z;
// gcc and clang
#if defined(__has_builtin)
#if __has_builtin(__builtin_add_overflow)
#if FASTFLOAT_HAS_BUILTIN(__builtin_add_overflow)
if (!is_constant_evaluated()) {
overflow = __builtin_add_overflow(x, y, &z);
return z;
}
#endif
#endif
// generic, this still optimizes correctly on MSVC.

View File

@ -79,7 +79,7 @@
#define FASTFLOAT_IS_CONSTEXPR 1
#define FASTFLOAT_HAS_IS_CONSTANT_EVALUATED 1
#else
#define FASTFLOAT_CONSTEVAL
#define FASTFLOAT_CONSTEVAL FASTFLOAT_CONSTEXPR14
#define FASTFLOAT_CONSTEXPR20
#define FASTFLOAT_IS_CONSTEXPR 0
#define FASTFLOAT_HAS_IS_CONSTANT_EVALUATED 0

View File

@ -241,7 +241,7 @@ parse_eight_digits(UC const *&p, limb &value, am_digits &counter,
}
template <typename UC>
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 void
fastfloat_really_inline FASTFLOAT_CONSTEXPR14 void
parse_four_digits(UC const *&p, limb &value, am_digits &counter,
am_digits &count) noexcept {
value = value * 10000 + parse_4_digits(read_chars_to_unsigned<uint32_t>(p));

View File

@ -294,7 +294,7 @@ namespace fast_float {
using std::bit_cast;
#else
template <typename To, typename From>
fastfloat_really_inline FASTFLOAT_CONSTEXPR20 To bit_cast(const From &from) {
fastfloat_really_inline FASTFLOAT_CONSTEXPR14 To bit_cast(const From &from) {
// Implementation of std::bit_cast for pre-C++20.
auto to = To();
// The cast suppresses a bogus -Wclass-memaccess on GCC.
@ -355,7 +355,7 @@ struct is_supported_char_type
#ifndef FASTFLOAT_ONLY_POSITIVE_C_NUMBER_WO_INF_NAN
template <typename UC>
inline FASTFLOAT_CONSTEXPR14 bool
inline FASTFLOAT_CONSTEXPR20 bool
fastfloat_strncasecmp3(UC const *actual_mixedcase,
UC const *expected_lowercase) {
if (is_constant_evaluated()) {
@ -396,7 +396,7 @@ fastfloat_strncasecmp3(UC const *actual_mixedcase,
}
template <typename UC>
inline FASTFLOAT_CONSTEXPR14 bool
inline FASTFLOAT_CONSTEXPR20 bool
fastfloat_strncasecmp5(UC const *actual_mixedcase,
UC const *expected_lowercase) noexcept {
if (is_constant_evaluated()) {
@ -447,7 +447,7 @@ fastfloat_strncasecmp5(UC const *actual_mixedcase,
// Compares two ASCII strings in a case insensitive manner.
template <typename UC>
inline FASTFLOAT_CONSTEXPR14 bool
inline FASTFLOAT_CONSTEXPR20 bool
fastfloat_strncasecmp(UC const *actual_mixedcase, UC const *expected_lowercase,
uint_fast8_t const length) noexcept {
if (is_constant_evaluated()) {