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

Clement Courbet via libc-commits libc-commits at lists.llvm.org
Wed Dec 20 06:31:55 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:

Is there any reason not to use a branchless version ? https://godbolt.org/z/4Mxso7bjG

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


More information about the libc-commits mailing list