[libc-commits] [libc] [libc][NFC] Introduce a Sign type for FPBits (PR #78500)

Clement Courbet via libc-commits libc-commits at lists.llvm.org
Thu Jan 18 02:12:39 PST 2024


================
@@ -39,17 +39,17 @@ template <typename T> LIBC_INLINE cpp::string str(fputil::FPBits<T> x) {
   if (x.is_nan())
     return "(NaN)";
   if (x.is_inf())
-    return x.get_sign() ? "(-Infinity)" : "(+Infinity)";
+    return x.is_neg() ? "(-Infinity)" : "(+Infinity)";
 
-  const auto sign_char = [](bool sign) -> char { return sign ? '1' : '0'; };
+  const auto sign_char = [](bool is_neg) -> char { return is_neg ? '1' : '0'; };
----------------
legrosbuffle wrote:

[nit] `const auto sign_char = [](Sign s) -> char { return s.is_neg() ? '1' : '0'; };`

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


More information about the libc-commits mailing list