[libc-commits] [PATCH] D150849: [libc] Extend IntegerToString to convert UInt* numbers to hex string.

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu May 18 06:37:54 PDT 2023


lntue accepted this revision.
lntue added inline comments.
This revision is now accepted and ready to land.


================
Comment at: libc/src/__support/integer_to_string.h:186
+    for (size_t i = 0; i < BLOCKS; ++i, val >>= (sizeof(uintmax_t) * 8)) {
+      uintmax_t block_val = static_cast<uintmax_t>(val & MASK);
+      hex(block_val,
----------------
I don't think we need to do `& MASK` in here, as the cast is well-defined.  If it's not correct, then we need to fix the cast to `uintmax_t` instead.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150849/new/

https://reviews.llvm.org/D150849



More information about the libc-commits mailing list