[libc-commits] [libc] [libc][NFC] Make EXP_MANT_MASK an implementation detail (PR #75810)

Clement Courbet via libc-commits libc-commits at lists.llvm.org
Mon Dec 18 07:58:19 PST 2023


================
@@ -162,13 +165,20 @@ struct FPProperties : public internal::FPBaseProperties<fp_type> {
       FRACTION_LEN + 1;
   LIBC_INLINE_VAR static constexpr StorageType FRACTION_MASK =
       mask_trailing_ones<StorageType, FRACTION_LEN>();
-  LIBC_INLINE_VAR static constexpr StorageType EXP_MANT_MASK =
-      EXP_MASK | SIG_MASK;
 
   // If a number x is a NAN, then it is a quiet NAN if:
   //   QuietNaNMask & bits(x) != 0
   // Else, it is a signalling NAN.
   static constexpr StorageType QUIET_NAN_MASK = QNAN_MASK;
+
+  //---------------------------------------------------------------------------
+  // Modifiers
+  //---------------------------------------------------------------------------
+
+  // Returns the absolute value of 'value'.
+  LIBC_INLINE static constexpr StorageType abs(StorageType value) {
----------------
legrosbuffle wrote:

It's weird to have a member function in a class named `FloatProperties`. This should probably be a free function with template properties.

Actually, I'm noting that this is aways called on the result of calling `FPBits::uintval()`, maybe it's a sign that this should be a member function of `FPBits` ?


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


More information about the libc-commits mailing list