[libc-commits] [libc] [libc][c++23][math] Implement comparison operations operator overloads for BFloat16 (PR #150087)

via libc-commits libc-commits at lists.llvm.org
Wed Jul 23 04:42:26 PDT 2025


================
@@ -57,6 +58,30 @@ struct BFloat16 {
     uint32_t x_bits = static_cast<uint32_t>(bits) << 16U;
     return cpp::bit_cast<float>(x_bits);
   }
+
+  LIBC_INLINE constexpr bool operator==(BFloat16 other) const {
----------------
overmighty wrote:

I was going to suggest `const BFloat16 &other` but it doesn't impact codegen since `BFloat16` is just a wrapper around `uint16_t`.

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


More information about the libc-commits mailing list