Skip to content

Conversation

@dlech
Copy link
Contributor

@dlech dlech commented Mar 24, 2022

This adds a new MP_SMALL_INT_BITS macro that is a compile-time constant that contains the number of bits available in an
MP_SMALL_INT.

We can use this in place of the runtime function mp_small_int_bits().

@dpgeorge dpgeorge added the py-core Relates to py/ directory in source label Mar 24, 2022
This adds a new `MP_SMALL_INT_BITS` macro that is a compile-time
constant that contains the number of bits available in an
`MP_SMALL_INT`.

We can use this in place of the runtime function `mp_small_int_bits()`.

Signed-off-by: David Lechner <[email protected]>
@dlech dlech force-pushed the mp-small-int-bits branch from 26441ad to 11aafbe Compare March 24, 2022 17:33
@dpgeorge
Copy link
Member

Thanks, merged in 768879f

Note: the compiler was actually optimising mp_small_int_bits() to a constant. But this macro is better and can be more easily used in multiple locations.

@dpgeorge dpgeorge closed this Mar 25, 2022
@dlech
Copy link
Contributor Author

dlech commented Mar 25, 2022

the compiler was actually optimising mp_small_int_bits() to a constant.

👍 I was wondering why the code size diff was 0.

@dlech dlech deleted the mp-small-int-bits branch March 25, 2022 01:30
tannewt added a commit to tannewt/circuitpython that referenced this pull request Feb 16, 2024
Doing it implicitly can lead to mistaken socket leaks and reuse.
It now matches CPython.

Fixes micropython#8443
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

py-core Relates to py/ directory in source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants