-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
mpprint: Rework integer vararg handling. #17618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Code size report:
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #17618 +/- ##
=======================================
Coverage 98.44% 98.44%
=======================================
Files 171 171
Lines 22204 22208 +4
=======================================
+ Hits 21859 21863 +4
Misses 345 345 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
1a0bc40
to
7829c6e
Compare
Wow! Nice code savings. |
I tested this locally on PYBV10 using |
Thanks! It may be a few days before I can implement your review suggestions. |
This adds support for %llx (needed by XINT_FMT for printing cell objects) and incidentally support for capitalized output of %P. Signed-off-by: Jeff Epler <jepler@gmail.com>
Test l and ll sized objects. When the platform's `mp_int_t` is not 64 bits, dummy values are printed instead so the test result can match across all platforms. Ensure hex test values have a letter so 'x' vs 'X' is tested. Test p and P pointer printing. Signed-off-by: Jeff Epler <jepler@gmail.com>
7829c6e
to
15e7c66
Compare
Updated. |
Summary
While working on format string errors in mp_printf (#17556) I experimented with adding support for %llx printing to mp_printf. In doing so, I re-organized mp_printf to increase the commonality of the various number printing possibilities.
When CI on 17556 turned up with a substantial size savings, it made me want to check if this change alone was the cause of the size savings. If so, and if the change is right, it might be worth taking independently of 17556.
Testing
I added new test cases to the unix coverage build and ran the tests locally. However, because the controls to enable/disable support for %l and %ll are different now, this really does need testing that is sure to cover all the cases and I'm not sure I've achieved that.
Trade-offs and Alternatives
In the current iteration of 17556, I am not actually using the llx format, so if this is not actually the source of the size savings reported there, then there's little reason to take it.
The changes to add MP_OBJ_FROM_PTR I think are "right" but they're incidental to this PR and should probably be rebased out. I briefly tried to enable the extra coverage code in the nanbox build and the build errored at these sites.Some other changes to the coverage tests were broken out to #17619