Closed skirpichev closed 12 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
e34324a
) 85.05% compared to head (eee6f31
) 85.35%.
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
This does make sense for div_2exp() as well. But I'm thinking about some code reorganization first.
Maybe it does make sense to add some GMPy_Integer_As???
utility function, that try conversion to unsigned long and then to long?
This does make sense for div_2exp() as well. But I'm thinking about some code reorganization first.
Maybe it does make sense to add some
GMPy_Integer_As???
utility function, that try conversion to unsigned long and then to long?
That would make sense. We need to include 64-bit values on Windows where long
is only 32-bits. size_t
and ssize_t
could be used as the types.
That would make sense.
Is there any potential use cases besides div_2exp()
?
Is there any potential use cases besides
div_2exp()
?
Those would be the most common. Almost any code that relies on bit positions or bit length could use size_t
or ssize_t
. See the bit indexing code in gmpy2_xmpz_misc.c
for use of ssize_t
.
@casevh, I think this is ready for review.
size_t and ssize_t could be used as the types.
I came to GMPy_Integer_AsUnsignedLongOrLong() helper function. GMP only has *_si/ui functions to work with signed/unsigned long.
CI failures are unrelated to this pr.
I came to GMPy_Integer_AsUnsignedLongOrLong() helper function. GMP only has *_si/ui functions to work with signed/unsigned long.
Agreed. Looks good. I'll merge it this weekend / when you tell me it is ready.
@casevh, it was mentioned above, that this pr is ready for review.
@casevh, I've added yet another (last, I think ;)) commit to this PR, which utilizes new function in iroot() (to raise OverflowError instead of ValueError's on overflow).
Thanks.