[llvm-branch-commits] [libc] [libc] Add Operator Overloads for Float80 (PR #214493)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Aug 20 08:56:16 PDT 2026


================
@@ -95,6 +96,57 @@ struct Float80 {
         x_bits.sign(), x_bits_exp, x_bits.get_explicit_mantissa());
     return static_cast<T>(xd.as_mantissa_type());
   }
+
+  // unary operators
+  LIBC_INLINE LIBC_BIT_CAST_CONSTEXPR Float80 operator-() const {
+    fputil::FPBits<Float80> result(*this);
+    result.set_sign(result.is_pos() ? Sign::NEG : Sign::POS);
+    return result.get_val();
+  }
+  LIBC_INLINE constexpr Float80 operator+(const Float80 &other) const {
----------------
overmighty wrote:

Nit:

```suggestion
  }

  LIBC_INLINE constexpr Float80 operator+(const Float80 &other) const {
```

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


More information about the llvm-branch-commits mailing list