mirror of
https://github.com/micropython/micropython.git
synced 2026-01-07 12:40:15 +01:00
all: Simplify mp_int_t/mp_uint_t definition.
Assuming proper C99 language support, we can select "the int type as big as a pointer" (most of the time) or "the 64-bit int type" (nanboxing with REPR_D), and then define everything else automatically. This simplifies port configuration files. And the types can still be overridden if needed. Signed-off-by: Jeff Epler <jepler@unpythonic.net>
This commit is contained in:
committed by
Damien George
parent
eac81de4e0
commit
007f127a61
@@ -77,10 +77,6 @@ bool mp_mul_ll_overflow(long long int x, long long int y, long long int *res) {
|
||||
return overflow;
|
||||
}
|
||||
|
||||
#define MP_UINT_MAX (~(mp_uint_t)0)
|
||||
#define MP_INT_MAX ((mp_int_t)(MP_UINT_MAX >> 1))
|
||||
#define MP_INT_MIN (-MP_INT_MAX - 1)
|
||||
|
||||
bool mp_mul_mp_int_t_overflow(mp_int_t x, mp_int_t y, mp_int_t *res) {
|
||||
// Check for multiply overflow; see CERT INT32-C
|
||||
if (x > 0) { // x is positive
|
||||
|
||||
Reference in New Issue
Block a user