mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-20 01:08:15 +01:00
[python] Upgrade to micropython 1.11
This commit is contained in:
@@ -207,7 +207,7 @@ int mp_print_mp_int(const mp_print_t *print, mp_obj_t x, int base, int base_char
|
||||
// If needed this function could be generalised to handle other values.
|
||||
assert(base == 2 || base == 8 || base == 10 || base == 16);
|
||||
|
||||
if (!MP_OBJ_IS_INT(x)) {
|
||||
if (!mp_obj_is_int(x)) {
|
||||
// This will convert booleans to int, or raise an error for
|
||||
// non-integer types.
|
||||
x = MP_OBJ_NEW_SMALL_INT(mp_obj_get_int(x));
|
||||
@@ -503,22 +503,28 @@ int mp_vprintf(const mp_print_t *print, const char *fmt, va_list args) {
|
||||
chrs += mp_print_strn(print, str, prec, flags, fill, width);
|
||||
break;
|
||||
}
|
||||
case 'd': {
|
||||
mp_int_t val;
|
||||
if (long_arg) {
|
||||
val = va_arg(args, long int);
|
||||
} else {
|
||||
val = va_arg(args, int);
|
||||
}
|
||||
chrs += mp_print_int(print, val, 1, 10, 'a', flags, fill, width);
|
||||
break;
|
||||
}
|
||||
case 'u':
|
||||
chrs += mp_print_int(print, va_arg(args, unsigned int), 0, 10, 'a', flags, fill, width);
|
||||
break;
|
||||
case 'd':
|
||||
chrs += mp_print_int(print, va_arg(args, int), 1, 10, 'a', flags, fill, width);
|
||||
break;
|
||||
case 'x':
|
||||
case 'X': {
|
||||
char fmt_c = *fmt - 'X' + 'A';
|
||||
int base = 16 - ((*fmt + 1) & 6); // maps char u/x/X to base 10/16/16
|
||||
char fmt_c = (*fmt & 0xf0) - 'P' + 'A'; // maps char u/x/X to char a/a/A
|
||||
mp_uint_t val;
|
||||
if (long_arg) {
|
||||
val = va_arg(args, unsigned long int);
|
||||
} else {
|
||||
val = va_arg(args, unsigned int);
|
||||
}
|
||||
chrs += mp_print_int(print, val, 0, 16, fmt_c, flags, fill, width);
|
||||
chrs += mp_print_int(print, val, 0, base, fmt_c, flags, fill, width);
|
||||
break;
|
||||
}
|
||||
case 'p':
|
||||
|
||||
Reference in New Issue
Block a user