diff options
author | Alessandro Gatti <a.gatti@frob.it> | 2024-09-19 20:29:00 +0200 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2024-09-23 11:47:18 +1000 |
commit | 8f465dfd10f8186873be0c38e226bcf380be16ba (patch) | |
tree | bf52535160cc86c01b2dc5f1de1855d01ac38733 /tools/metrics.py | |
parent | bb3c711c04518bf926f85e05d29e8fbfc9dd1b93 (diff) |
unix/modffi: Restrict uint32_t values to 32 bits.
This commit clears the upper 32 bits of returned `uint32_t` values,
which are handled as `unsigned int`s by the MicroPython runtime and
thus could be extended to 64 bits on some platforms.
RV64 holds 32-bit values as signed integers when held in registers, but
the code handling the FFI unsigned int case did not take this into
account. That introduced test failures when a 32-bit value had its most
significant bit set, as when performing the value extension from 32 to
64 bits, the upper half of the value would be filled with ones.
On 32 bit platforms this change should be converted to a no-op, and
on other 64 bit platforms that aren't RISC-V it shouldn't hurt as the
value being manipulated is expected to only hold valid bits in its lower
half.
Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Diffstat (limited to 'tools/metrics.py')
0 files changed, 0 insertions, 0 deletions