[libc-commits] [PATCH] D156813: [libc] Fix float to string conversion in 32-bit systems
Mikhail Ramalho via Phabricator via libc-commits
libc-commits at lists.llvm.org
Tue Aug 1 10:46:03 PDT 2023
mikhail.ramalho updated this revision to Diff 546135.
mikhail.ramalho added a comment.
Addressed comment to use UInt constructor.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156813/new/
https://reviews.llvm.org/D156813
Files:
libc/src/__support/float_to_string.h
Index: libc/src/__support/float_to_string.h
===================================================================
--- libc/src/__support/float_to_string.h
+++ libc/src/__support/float_to_string.h
@@ -387,15 +387,9 @@
const int32_t shift_amount) {
constexpr size_t MANT_INT_SIZE = sizeof(MantissaInt) * 8;
cpp::UInt<MID_INT_SIZE + MANT_INT_SIZE> val(large);
- // TODO: Find a better way to force __uint128_t to be UInt<128>
- cpp::UInt<MANT_INT_SIZE> wide_mant(0);
- wide_mant[0] = static_cast<size_t>(mantissa & (uint64_t(-1)));
- wide_mant[1] = static_cast<size_t>(mantissa >> 64);
- val = (val * wide_mant) >> shift_amount;
-
+ val = (val * mantissa) >> shift_amount;
return static_cast<uint32_t>(
val.div_uint32_times_pow_2(1000000000, 0).value());
- // return fast_uint_mod_1e9(val);
}
} // namespace internal
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156813.546135.patch
Type: text/x-patch
Size: 879 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230801/10491ce6/attachment.bin>
More information about the libc-commits
mailing list