[libc-commits] [libc] [libc][NFC] Unify `FPBits` implementations (PR #76033)

Clement Courbet via libc-commits libc-commits at lists.llvm.org
Thu Dec 21 01:30:12 PST 2023


================
@@ -84,13 +84,12 @@ struct FPBits<long double>
   }
 
   LIBC_INLINE constexpr void set_sign(bool signVal) {
-    bits &= ~SIGN_MASK;
-    StorageType sign1 = StorageType(signVal) << (TOTAL_LEN - 1);
-    bits |= sign1;
+    if (get_sign() != signVal)
----------------
legrosbuffle wrote:

> Ah, right. I misread the code. There should probably be documentation for the function :) Or is it elsewhere and did I miss it somehow ? Also the name is misleading (but probably in a separate change ?)

Sorry, brain fart. I got the semantics right and my implementation was incorrect. The bit hacks one looks really good, especially on GCC !

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


More information about the libc-commits mailing list