[libc-commits] [libc] [libc][NFC] Simplify FloatProperties implementation (PR #74481)

via libc-commits libc-commits at lists.llvm.org
Tue Dec 5 11:17:31 PST 2023


================
@@ -27,22 +27,98 @@ enum class FPType {
   X86_Binary80,
 };
 
-template <FPType> struct FPProperties {};
-template <> struct FPProperties<FPType::IEEE754_Binary32> {
-  typedef uint32_t BitsType;
+// For now 'FPEncoding', 'FPBaseProperties' and 'FPCommonProperties' are
+// implementation details.
+namespace internal {
+
+// The type of encoding for supported floating point types.
+enum class FPEncoding {
+  IEEE754,
+  X86_ExtendedPrecision,
+};
+
+template <FPType> struct FPBaseProperties {};
+
+template <> struct FPBaseProperties<FPType::IEEE754_Binary16> {
+  LIBC_INLINE_VAR static constexpr int FP_BITS = 16;
----------------
michaelrj-google wrote:

given that FPBits is already a class used elsewhere in the code, I think we should use a different name for the total width of the type. Maybe `SIZE` or `TOTAL_BITS`?

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


More information about the libc-commits mailing list