[libc-commits] [libc] [libc] Fix cast semantic in integer_to_string (PR #73804)

via libc-commits libc-commits at lists.llvm.org
Wed Nov 29 07:27:03 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Guillaume Chatelet (gchatelet)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/73804.diff


1 Files Affected:

- (modified) libc/src/__support/integer_to_string.h (+1-1) 


``````````diff
diff --git a/libc/src/__support/integer_to_string.h b/libc/src/__support/integer_to_string.h
index 6bbedac68efce2e..8d3859c8eb0ca5f 100644
--- a/libc/src/__support/integer_to_string.h
+++ b/libc/src/__support/integer_to_string.h
@@ -255,7 +255,7 @@ template <typename T, typename Fmt = radix::Dec> class IntegerToString {
       if constexpr (Fmt::BASE == 10) {
         write_unsigned_number(abs(value), sink);
       } else {
-        write_unsigned_number(cpp::bit_cast<UNSIGNED_T>(value), sink);
+        write_unsigned_number(static_cast<UNSIGNED_T>(value), sink);
       }
       // width
       while (sink.ok() && sink.size() < Fmt::MIN_DIGITS)

``````````

</details>


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


More information about the libc-commits mailing list