[llvm] [libc] [libc][NFC] Refactor FPBits and remove LongDoubleBits specialization (PR #78192)

Clement Courbet via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 16 00:49:40 PST 2024


================
@@ -132,6 +132,70 @@ struct FPRepBase : public internal::FPLayout<fp_type> {
   static_assert((SIG_MASK & EXP_MASK & SIGN_MASK) == 0, "masks disjoint");
   static_assert((SIG_MASK | EXP_MASK | SIGN_MASK) == FP_MASK, "masks cover");
 
+protected:
+  enum class Exp : int32_t {
+    ZERO = 0,
+    // The exponent value for denormal numbers.
+    SUBNORMAL = -EXP_BIAS,
+    // The minimum exponent value for normal numbers.
+    MIN = SUBNORMAL + 1,
+    // The maximum exponent value for normal numbers.
+    MAX = EXP_BIAS,
+    // Special value all ones.
+    INF = MAX + 1,
+    // Aliases
+    BITS_ALL_ZEROES = SUBNORMAL,
+    BITS_ALL_ONES = INF,
+  };
+
+  enum class Sig : StorageType {
----------------
legrosbuffle wrote:

`Sig` is not very self-explanatory. `Significand` is not taken. Or at least add a comment. 

Actually `Sig` does not represent any significand value, but only specific ones. 

```
// A set of specific significand values. Closed under operations or, xor, shift right.
```

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


More information about the llvm-commits mailing list