[libc-commits] [libc] [libc][stdfix] Add support for fixed point types in the testing infrastructure. (PR #81819)

Michael Jones via libc-commits libc-commits at lists.llvm.org
Thu Feb 15 11:01:46 PST 2024


================
@@ -53,6 +55,17 @@ describeValue(ValType Value) {
   return cpp::to_string(Value);
 }
 
+#ifdef LIBC_COMPILER_HAS_FIXED_POINT
+template <typename T>
+cpp::enable_if_t<cpp::is_fixed_point_v<T>, cpp::string> describeValue(T Value) {
+  using FXRep = fixed_point::FXRep<T>;
+  using comp_t = typename FXRep::CompType;
+
+  return cpp::to_string(cpp::bit_cast<comp_t>(Value)) + " * 2^-" +
----------------
michaelrj-google wrote:

could you add a TODO to switch this to proper fixed point printing when that's available?

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


More information about the libc-commits mailing list