@@ -23,13 +23,13 @@ namespace fputil {
23
23
// which uses FMA instructions to speed up if available.
24
24
25
25
template <typename T>
26
- LIBC_INLINE cpp::enable_if_t <(sizeof (T) > sizeof (void *)), T>
26
+ LIBC_INLINE static constexpr cpp::enable_if_t <(sizeof (T) > sizeof (void *)), T>
27
27
multiply_add (const T &x, const T &y, const T &z) {
28
28
return x * y + z;
29
29
}
30
30
31
31
template <typename T>
32
- LIBC_INLINE cpp::enable_if_t <(sizeof (T) <= sizeof (void *)), T>
32
+ LIBC_INLINE static constexpr cpp::enable_if_t <(sizeof (T) <= sizeof (void *)), T>
33
33
multiply_add (T x, T y, T z) {
34
34
return x * y + z;
35
35
}
@@ -47,7 +47,7 @@ namespace LIBC_NAMESPACE_DECL {
47
47
namespace fputil {
48
48
49
49
#ifdef LIBC_TARGET_CPU_HAS_FMA_FLOAT
50
- LIBC_INLINE float multiply_add (float x, float y, float z) {
50
+ LIBC_INLINE static constexpr float multiply_add (float x, float y, float z) {
51
51
#if __has_builtin(__builtin_elementwise_fma)
52
52
return __builtin_elementwise_fma (x, y, z);
53
53
#else
@@ -57,7 +57,7 @@ LIBC_INLINE float multiply_add(float x, float y, float z) {
57
57
#endif // LIBC_TARGET_CPU_HAS_FMA_FLOAT
58
58
59
59
#ifdef LIBC_TARGET_CPU_HAS_FMA_DOUBLE
60
- LIBC_INLINE double multiply_add (double x, double y, double z) {
60
+ LIBC_INLINE static constexpr double multiply_add (double x, double y, double z) {
61
61
#if __has_builtin(__builtin_elementwise_fma)
62
62
return __builtin_elementwise_fma (x, y, z);
63
63
#else
0 commit comments