Skip to content
Snippets Groups Projects
Commit c1c57eaf authored by Damien George's avatar Damien George
Browse files

py/smallint: Allow to override MP_SMALL_INT_MIN et al.

This allows a port to specify exactly how many bits are in a small
int (eg for a uPy bytecode cross compiler).
parent 1fa6be52
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
// Functions for small integer arithmetic // Functions for small integer arithmetic
#ifndef MP_SMALL_INT_MIN
// In SMALL_INT, next-to-highest bits is used as sign, so both must match for value in range // In SMALL_INT, next-to-highest bits is used as sign, so both must match for value in range
#if MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_A || MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_C #if MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_A || MICROPY_OBJ_REPR == MICROPY_OBJ_REPR_C
...@@ -55,6 +57,8 @@ ...@@ -55,6 +57,8 @@
#endif #endif
#endif
#define MP_SMALL_INT_MAX ((mp_int_t)(~(MP_SMALL_INT_MIN))) #define MP_SMALL_INT_MAX ((mp_int_t)(~(MP_SMALL_INT_MIN)))
bool mp_small_int_mul_overflow(mp_int_t x, mp_int_t y); bool mp_small_int_mul_overflow(mp_int_t x, mp_int_t y);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment