[libc-commits] [libc] [libc][math][c23] Add fabsf16 C23 math function (PR #93567)

Nick Desaulniers via libc-commits libc-commits at lists.llvm.org
Tue May 28 09:41:57 PDT 2024


================
@@ -24,7 +24,14 @@ template <typename T> struct is_floating_point {
   }
 
 public:
-#if defined(LIBC_TYPES_HAS_FLOAT128)
+#if defined(LIBC_TYPES_HAS_FLOAT16) && defined(LIBC_TYPES_HAS_FLOAT128)
+  LIBC_INLINE_VAR static constexpr bool value =
+      __is_unqualified_any_of<T, float, double, long double, float16,
+                              float128>();
+#elif defined(LIBC_TYPES_HAS_FLOAT16)
+  LIBC_INLINE_VAR static constexpr bool value =
+      __is_unqualified_any_of<T, float, double, long double, float16>();
+#elif defined(LIBC_TYPES_HAS_FLOAT128)
   LIBC_INLINE_VAR static constexpr bool value =
       __is_unqualified_any_of<T, float, double, long double, float128>();
----------------
nickdesaulniers wrote:

```suggestion
  LIBC_INLINE_VAR static constexpr bool value =
      __is_unqualified_any_of<T, float, double, long double
#ifdef LIBC_TYPES_HAS_FLOAT16
      , float16
#endif
#ifdef LIBC_TYPES_HAS_FLOAT128
      , float128
#endif
  >();
```

https://github.com/llvm/llvm-project/pull/93567


More information about the libc-commits mailing list