Skip to content

Commit a48ab43

Browse files
barracuda156serge-sans-paille
authored andcommitted
xsimd_scalar.hpp: fix for missing exp10 on macOS < 10.9
1 parent c1247bf commit a48ab43

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

include/xsimd/arch/xsimd_scalar.hpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
#include "xtl/xcomplex.hpp"
2525
#endif
2626

27+
#ifdef __APPLE__
28+
#include <AvailabilityMacros.h>
29+
#endif
30+
2731
namespace xsimd
2832
{
2933
template <class T, class A>
@@ -502,7 +506,7 @@ namespace xsimd
502506
return !(x0 == x1);
503507
}
504508

505-
#if defined(__APPLE__)
509+
#if defined(__APPLE__) && (MAC_OS_X_VERSION_MIN_REQUIRED > 1080)
506510
inline float exp10(const float& x) noexcept
507511
{
508512
return __exp10f(x);
@@ -520,6 +524,15 @@ namespace xsimd
520524
{
521525
return ::exp10(x);
522526
}
527+
#elif !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 5)
528+
inline float exp10(const float& x) noexcept
529+
{
530+
return __builtin_exp10f(x);
531+
}
532+
inline double exp10(const double& x) noexcept
533+
{
534+
return __builtin_exp10(x);
535+
}
523536
#elif defined(_WIN32)
524537
template <class T, class = typename std::enable_if<std::is_scalar<T>::value>::type>
525538
inline T exp10(const T& x) noexcept

0 commit comments

Comments
 (0)