Skip to content

Commit

Permalink
Encapsulate the use of macro and leave comment
Browse files Browse the repository at this point in the history
  • Loading branch information
robincaloudis committed Sep 7, 2024
1 parent 528be9e commit 9c24e8d
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions libcxx/include/__math/traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,30 +34,27 @@ namespace __math {
# define _LIBCPP_SIGNBIT_CONSTEXPR
#endif

_LIBCPP_NODISCARD inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
#ifdef _LIBCPP_PREFERRED_OVERLOAD
_LIBCPP_PREFERRED_OVERLOAD
// The universal C runtime (UCRT) in the WinSDK provides overloads for all floating point types
// for std::signbit(). We need to work around it as the compilation would otherwise error out
// due to duplicated definitions for clang-cl builds.
#if defined(_LIBCPP_MSVCRT) && defined(_LIBCPP_PREFERRED_OVERLOAD)
# define LIBCPP_SIGNBIT_OVERLOAD _LIBCPP_PREFERRED_OVERLOAD
#else
# define LIBCPP_SIGNBIT_OVERLOAD
#endif
bool
signbit(float __x) _NOEXCEPT {

_LIBCPP_NODISCARD inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI LIBCPP_SIGNBIT_OVERLOAD bool
signbit(float __x) _NOEXCEPT {
return __builtin_signbit(__x);
}

_LIBCPP_NODISCARD inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
#ifdef _LIBCPP_PREFERRED_OVERLOAD
_LIBCPP_PREFERRED_OVERLOAD
#endif
bool
signbit(double __x) _NOEXCEPT {
_LIBCPP_NODISCARD inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI LIBCPP_SIGNBIT_OVERLOAD bool
signbit(double __x) _NOEXCEPT {
return __builtin_signbit(__x);
}

_LIBCPP_NODISCARD inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI
#ifdef _LIBCPP_PREFERRED_OVERLOAD
_LIBCPP_PREFERRED_OVERLOAD
#endif
bool
signbit(long double __x) _NOEXCEPT {
_LIBCPP_NODISCARD inline _LIBCPP_SIGNBIT_CONSTEXPR _LIBCPP_HIDE_FROM_ABI LIBCPP_SIGNBIT_OVERLOAD bool
signbit(long double __x) _NOEXCEPT {
return __builtin_signbit(__x);
}

Expand Down

0 comments on commit 9c24e8d

Please sign in to comment.