[libc-commits] [libc] [libc] Added support for fixed-points in ``is_signed`` and ``is_unsigned``. (PR #133371)
via libc-commits
libc-commits at lists.llvm.org
Fri Mar 28 19:55:28 PDT 2025
================
@@ -10,18 +10,73 @@
#include "src/__support/CPP/type_traits/bool_constant.h"
#include "src/__support/CPP/type_traits/is_arithmetic.h"
+#include "src/__support/CPP/type_traits/is_fixed_point.h"
#include "src/__support/macros/attributes.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
namespace cpp {
-// is_signed
+// Primary template: handles arithmetic and signed fixed-point types
template <typename T>
-struct is_signed : bool_constant<(is_arithmetic_v<T> && (T(-1) < T(0)))> {
+struct is_signed : bool_constant<((is_fixed_point_v<T> || is_arithmetic_v<T>) &&
----------------
lntue wrote:
@PiJoules is there problem with constexpr for fixed point type in clang?
https://github.com/llvm/llvm-project/pull/133371
More information about the libc-commits
mailing list