Skip to content

Commit 5f8ad28

Browse files
committed
py/mpprint: Make "%p" format work properly on 64-bit systems.
Before, the output was truncated to 32 bits.
1 parent ada1dc1 commit 5f8ad28

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

py/mpprint.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,8 @@ int mp_vprintf(const mp_print_t *print, const char *fmt, va_list args) {
512512
break;
513513
case 'p':
514514
case 'P': // don't bother to handle upcase for 'P'
515-
chrs += mp_print_int(print, va_arg(args, unsigned int), 0, 16, 'a', flags, fill, width);
515+
// Use unsigned long int to work on both ILP32 and LP64 systems
516+
chrs += mp_print_int(print, va_arg(args, unsigned long int), 0, 16, 'a', flags, fill, width);
516517
break;
517518
#if MICROPY_PY_BUILTINS_FLOAT
518519
case 'e':

0 commit comments

Comments
 (0)