[libc-commits] [libc] [libc][NFC] Simplify `FPBits` (PR #76835)

Clement Courbet via libc-commits libc-commits at lists.llvm.org
Wed Jan 3 09:40:09 PST 2024


================
@@ -37,20 +37,21 @@ struct FPBits<long double> : public internal::FPRep<FPType::X86_Binary80> {
   using UP::QUIET_NAN_MASK;
 
 public:
-  static constexpr int MAX_BIASED_EXPONENT = 0x7FFF;
+  static constexpr int MAX_BIASED_EXPONENT = (1 << EXP_LEN) - 1;
+  // The x86 80 bit float represents the leading digit of the mantissa
+  // explicitly. This is the mask for that bit.
+  static constexpr StorageType EXPLICIT_BIT_MASK = StorageType(1)
+                                                   << FRACTION_LEN;
+  static_assert((EXPLICIT_BIT_MASK & FRACTION_MASK) == 0, "mask disjoint");
+  static_assert((EXPLICIT_BIT_MASK | FRACTION_MASK) == SIG_MASK, "mask cover");
   static constexpr StorageType MIN_SUBNORMAL = StorageType(1);
-  // Subnormal numbers include the implicit bit in x86 long double formats.
----------------
legrosbuffle wrote:

Let's keep the comment.

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


More information about the libc-commits mailing list