Closed jamesjer closed 2 months ago
:warning: Please install the to ensure uploads and comments are reliably processed by Codecov.
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 85.50%. Comparing base (
224745b
) to head (4b3aee6
). Report is 30 commits behind head on master.
: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.
Windows fix: #491
I think the PR comment is unnecessarily verbose. How does this look?
Yep, fine.
Thanks for the fix.
Maybe this should go to the next bugfix release?
I agree. I can release 2.2.1 this weekend.
On Thu, Jul 11, 2024, 11:46 PM Sergey B Kirpichev @.***> wrote:
Maybe this should go to the next bugfix release?
— Reply to this email directly, view it on GitHub https://github.com/aleaxit/gmpy/pull/490#issuecomment-2224927276, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMR233MLC63XWDGHKDBIM3ZL53TZAVCNFSM6AAAAABKTGOBYGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRUHEZDOMRXGY . You are receiving this because you modified the open/close state.Message ID: @.***>
I attempted to build version 2.2.0 for Fedora Rawhide. All of the non-x86 architectures (aarch, ppc64le, and s390x) failed a test:
The problem is the use of the
char
type for flag variables. The C standard says thatchar
can be equivalent to eithersigned char
orunsigned char
. The code inGMPy_MPZ_Method_From_Bytes
assigns -1 to such a variable,endian
. On platforms wherechar
==unsigned char
, the value stored is actually 255, a positive value.This PR converts flag variables declared with type
char
to typeint
instead, for the following reasons:char
doesn't save any space. These are local variables, so they are either in a CPU register (which is 32 or 64 bits, even if we only use 8 bits), or on the stack where, for alignment reasons, 32 bits will be reserved even though we only use 8 bits of it.char
instead ofint
generates less efficient code. Modern 64-bit processors are optimized for processing 64-bit and 32-bit quantities. They can operate on 8-bit quantities, but take more clock cycles to do so.char
type is only useful for unsigned 7-bit values; i.e., 0 to 127. That is the intersection of thesigned char
andunsigned char
types.With this change, the build succeeds on all architectures.