We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2adf7ec commit da3dffaCopy full SHA for da3dffa
1 file changed
py/objint.c
@@ -107,7 +107,9 @@ mp_fp_as_int_class_t mp_classify_fp_as_int(mp_float_t val) {
107
} else {
108
e &= ~((1 << MP_FLOAT_EXP_SHIFT_I32) - 1);
109
}
110
- if (e <= ((BITS_PER_WORD + MP_FLOAT_EXP_BIAS - 3) << MP_FLOAT_EXP_SHIFT_I32)) {
+ // 8 * sizeof(uintptr_t) counts the number of bits for a small int
111
+ // TODO provide a way to configure this properly
112
+ if (e <= ((8 * sizeof(uintptr_t) + MP_FLOAT_EXP_BIAS - 3) << MP_FLOAT_EXP_SHIFT_I32)) {
113
return MP_FP_CLASS_FIT_SMALLINT;
114
115
#if MICROPY_LONGINT_IMPL == MICROPY_LONGINT_IMPL_LONGLONG
0 commit comments