[libc-commits] [libc] [libc][NFC] Introduce a Sign type for FPBits (PR #78500)

Clement Courbet via libc-commits libc-commits at lists.llvm.org
Thu Jan 18 02:12:40 PST 2024


================
@@ -118,9 +118,9 @@ template <> LIBC_INLINE double fma<double>(double x, double y, double z) {
   }
 
   FPBits x_bits(x), y_bits(y), z_bits(z);
-  bool x_sign = x_bits.get_sign();
-  bool y_sign = y_bits.get_sign();
-  bool z_sign = z_bits.get_sign();
+  bool x_sign = x_bits.is_neg();
+  bool y_sign = y_bits.is_neg();
+  bool z_sign = z_bits.is_neg();
   bool prod_sign = x_sign != y_sign;
----------------
legrosbuffle wrote:

We don't really need `x_sign` and `y_sign`:

```
const Sign z_sign = z_bits.sign();
Sign prod_sign = (x_bits.sign() != y_bits.sign()) ? NEG : POS;
```


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


More information about the libc-commits mailing list