mirror of
https://github.com/fastfloat/fast_float.git
synced 2025-12-06 16:56:57 +08:00
Readded FASTFLOAT_CONSTEVAL, but not used currently. Cleanup for FASTFLOAT_ASSUME.
This commit is contained in:
parent
ee620a029d
commit
1651c2b0f8
@ -23,8 +23,10 @@
|
|||||||
#if defined(__cpp_lib_is_constant_evaluated) && \
|
#if defined(__cpp_lib_is_constant_evaluated) && \
|
||||||
__cpp_lib_is_constant_evaluated >= 201811L
|
__cpp_lib_is_constant_evaluated >= 201811L
|
||||||
#define FASTFLOAT_HAS_IS_CONSTANT_EVALUATED 1
|
#define FASTFLOAT_HAS_IS_CONSTANT_EVALUATED 1
|
||||||
|
#define FASTFLOAT_CONSTEVAL consteval
|
||||||
#else
|
#else
|
||||||
#define FASTFLOAT_HAS_IS_CONSTANT_EVALUATED 0
|
#define FASTFLOAT_HAS_IS_CONSTANT_EVALUATED 0
|
||||||
|
#define FASTFLOAT_CONSTEVAL FASTFLOAT_CONSTEXPR14
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__cpp_lib_byteswap)
|
#if defined(__cpp_lib_byteswap)
|
||||||
@ -58,24 +60,10 @@
|
|||||||
|
|
||||||
|
|
||||||
// For support attribute [[assume]] is declared in P1774
|
// For support attribute [[assume]] is declared in P1774
|
||||||
#if 1 // TODO needs platform specific tests for this
|
#if defined(__cpp_attrubute_assume)
|
||||||
#define FASTFLOAT_ASSUME(expr)
|
|
||||||
#elif defined(__cpp_attrubute_assume)
|
|
||||||
#define FASTFLOAT_ASSUME(expr) [[assume(expr)]]
|
#define FASTFLOAT_ASSUME(expr) [[assume(expr)]]
|
||||||
#elif defined(__clang__) // needs testing
|
#else
|
||||||
#define FASTFLOAT_ASSUME(expr) __builtin_assume(expr)
|
#define FASTFLOAT_ASSUME(expr)
|
||||||
#elif defined(__GNUC__) && !defined(__ICC) // needs testing
|
|
||||||
#define FASTFLOAT_ASSUME(expr) \
|
|
||||||
if (expr) { \
|
|
||||||
} else { \
|
|
||||||
__builtin_unreachable(); \
|
|
||||||
}
|
|
||||||
#elif defined(__ICC) // needs testing
|
|
||||||
#define FASTFLOAT_ASSUME(expr) __assume(expr)
|
|
||||||
#elif defined(_MSC_VER) // needs testing
|
|
||||||
/* currently disable, because MSVC is generated slower code when enabled,
|
|
||||||
it's probably reason why MSVC doesnt have [[assume]] */
|
|
||||||
#define FASTFLOAT_ASSUME(expr) /*__assume(expr)*/
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // FASTFLOAT_CONSTEXPR_FEATURE_DETECT_H
|
#endif // FASTFLOAT_CONSTEXPR_FEATURE_DETECT_H
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user