Unify charconv umul128 with shared _Base128 implementation - #6355
Unify charconv umul128 with shared _Base128 implementation#6355DAVID RINALDI (notedavidrinaldi) wants to merge 1 commit into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Hi team — I understand this PR is blocked by code-owner review. Could we please get a review from the Thanks! This PR addresses #6352 and only changes:
|
There was a problem hiding this comment.
Pull request overview
This PR removes the duplicated 128-bit multiply fallback in <xcharconv_ryu.h> by delegating to the shared, well-tested _Base128::_UMul128() in <__msvc_int128.hpp>. This addresses issue #6352, following #6281 which unified the ARM64/x64 intrinsic paths, so the two helpers no longer maintain parallel x86/constexpr fallback implementations.
Changes:
- Include
<__msvc_int128.hpp>so__ryu_umul128can call_Base128::_UMul128. - Replace the native-X64 intrinsic fallback and the entire non-intrinsic manual multiply in
__ryu_umul128with a call to_Base128::_UMul128(__a, __b, *__productHi). - Keep the ARM64/ARM64EC
__umulhintrinsic path unchanged.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| #include <xcharconv.h> | ||
| #include <xcharconv_ryu_tables.h> | ||
| #include <xutility> | ||
| #include <__msvc_int128.hpp> |
There was a problem hiding this comment.
Thanks for the review! Fixed in latest push:
- moved
#include <__msvc_int128.hpp>to the top of the include block before standard headers, matching STL internal include-order conventions.
98cf9fc to
23fd6a0
Compare
|
@microsoft-github-policy-service agree |
|
Commenter does not have sufficient privileges for PR 6355 in repo microsoft/STL |
|
I can't trigger pipeline because no privileges; please run /azp run on this PR. |
|
We haven't merged #6281 yet, and there's no benchmark results here demonstrating that you've picked the faster implementation. |
|
I've benchmarked this on x86 and we need to do the opposite. Closing this PR, I'll create one myself (Ryu has special licensing that needs to be dealt with). Thanks for looking into this. For future reference, please note how our PR template mentions that AI-generated pull requests and AI-generated PR descriptions are discouraged. |
Closes #6352
Summary
This change removes duplicated 128-bit multiply fallback logic in
xcharconvby reusing the existing shared implementation in_Base128.stl/inc/xcharconv_ryu.h, include__msvc_int128.hppso__ryu_umul128can call_Base128::_UMul128.__ryu_umul128with:return _Base128::_UMul128(__a, __b, *__productHi);Rationale
After #6281,
_Base128::_UMul128()is available as a common, well-tested fallback path. Reusing it from__ryu_umul128:xcharconvand other internal integer helpers.Validation
stl/inc/xcharconv_ryu.h