[libc-commits] [libc] [libc] Fix for adding macro I (PR #111872)

via libc-commits libc-commits at lists.llvm.org
Fri Oct 11 11:16:38 PDT 2024


================
@@ -346,12 +346,13 @@ fromfpx(T x, int rnd, unsigned int width) {
 
 namespace internal {
 
-template <typename F, typename I,
-          cpp::enable_if_t<cpp::is_floating_point_v<F> && cpp::is_integral_v<I>,
-                           int> = 0>
-LIBC_INLINE I rounded_float_to_signed_integer(F x) {
-  constexpr I INTEGER_MIN = (I(1) << (sizeof(I) * 8 - 1));
-  constexpr I INTEGER_MAX = -(INTEGER_MIN + 1);
+template <
+    typename F, typename InType,
+    cpp::enable_if_t<cpp::is_floating_point_v<F> && cpp::is_integral_v<InType>,
+                     int> = 0>
+LIBC_INLINE InType rounded_float_to_signed_integer(F x) {
----------------
lntue wrote:

The integer type is actually output type, so maybe change the template to
```
template <typename FloatType, typename IntType, ...>
```

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


More information about the libc-commits mailing list