[libc-commits] [libc] [libc] `FPRep` builders return `FPRep` instead of raw `StorageType` (PR #78588)
Clement Courbet via libc-commits
libc-commits at lists.llvm.org
Mon Jan 22 04:09:59 PST 2024
================
@@ -64,90 +64,101 @@ LIBC_INLINE_VAR constexpr Sign Sign::POS = Sign(false);
// └─────────▲─────────┘
// │
// ┌─────────┴─────────┐
-// │ FPRepBase<FPType> │
+// │ FPStorage<FPType> │
// └─────────▲─────────┘
// │
// ┌────────────┴─────────────┐
// │ │
-// ┌────────┴──────┐ ┌─────────────┴──────────────┐
-// │ FPRep<FPType> │ │ FPRep<FPType::X86_Binary80 │
-// └────────▲──────┘ └─────────────▲──────────────┘
+// ┌────────┴─────────┐ ┌──────────────┴──────────────────┐
+// │ FPRepSem<FPType> │ │ FPRepSem<FPType::X86_Binary80 │
+// └────────▲─────────┘ └──────────────▲──────────────────┘
// │ │
// └────────────┬─────────────┘
// │
// ┌─────┴─────┐
+// │ FPRep<T> │
+// └───────────┘
+// │
+// ┌─────┴─────┐
// │ FPBits<T> │
// └───────────┘
//
-// - 'FPLayout' defines only a few constants, namely the 'StorageType' and the
-// length of the sign, the exponent and significand parts.
-// - 'FPRepBase' builds more constants on top of those from 'FPLayout' like
-// exponent bias, shifts and masks. It also defines tools to assemble or test
+// - 'FPLayout' defines only a few constants, namely the 'StorageType' and
+// length of the sign, the exponent, fraction and significand parts.
+// - 'FPStorage' builds more constants on top of those from 'FPLayout' like
+// exponent bias and masks. It also holds the bit representation of the
+// floating point as a 'StorageType' type and defines tools to assemble or test
// these parts.
-// - 'FPRep' defines functions to interact with the floating point
+// - 'FPRepSem' defines functions to interact with the floating point
// representation. The default implementation is the one for 'IEEE754', a
-// specialization is provided for X86 Extended Precision that has a different
-// encoding.
-// - 'FPBits' is templated on the platform floating point types. Contrary to
-// 'FPRep' that is platform agnostic 'FPBits' is architecture dependent.
+// specialization is provided for X86 Extended Precision.
+// - 'FPRep' derives from 'FPRepSem' and adds functions that are common to all
+// implementations.
+// - 'FPBits' exposes all functions from 'FPRep' but operates on the native C++
+// floating point type instead of 'FPType'.
namespace internal {
// Defines the layout (sign, exponent, significand) of a floating point type in
// memory. It also defines its associated StorageType, i.e., the unsigned
// integer type used to manipulate its representation.
+// Additionally we provide the fration part length, i.e., the number of bits
----------------
legrosbuffle wrote:
*fractional
https://github.com/llvm/llvm-project/pull/78588
More information about the libc-commits
mailing list