summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-12-07 09:04:54 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-12-07 09:06:07 +0200
commit5f8ad284f81c3f51be9b3d00ea9fee21ba727a97 (patch)
tree102be34bf48c5fe33eefcaaa6800b989fb7a5ea8 /py
parentada1dc1c037371cd4680b00acff4bceaea511151 (diff)
py/mpprint: Make "%p" format work properly on 64-bit systems.
Before, the output was truncated to 32 bits.
Diffstat (limited to 'py')
-rw-r--r--py/mpprint.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/py/mpprint.c b/py/mpprint.c
index a569ef793..74912eb5f 100644
--- a/py/mpprint.c
+++ b/py/mpprint.c
@@ -512,7 +512,8 @@ int mp_vprintf(const mp_print_t *print, const char *fmt, va_list args) {
break;
case 'p':
case 'P': // don't bother to handle upcase for 'P'
- chrs += mp_print_int(print, va_arg(args, unsigned int), 0, 16, 'a', flags, fill, width);
+ // Use unsigned long int to work on both ILP32 and LP64 systems
+ chrs += mp_print_int(print, va_arg(args, unsigned long int), 0, 16, 'a', flags, fill, width);
break;
#if MICROPY_PY_BUILTINS_FLOAT
case 'e':