Commit df732bb0 authored by Paul Sokolovsky's avatar Paul Sokolovsky Committed by Damien George
Browse files

pfenv_printf: Properly implement %p format specifier.

Previously, it truncated pointer value to 32 bits on 64-bit systems.
parent 1eca3283
......@@ -146,13 +146,15 @@ int pfenv_vprintf(const pfenv_t *pfenv, const char *fmt, va_list args) {
chrs += pfenv_print_int(pfenv, va_arg(args, int), 1, 10, 'a', flags, fill, width);
break;
case 'x':
case 'p': // ?
chrs += pfenv_print_int(pfenv, va_arg(args, int), 0, 16, 'a', flags, fill, width);
break;
case 'X':
case 'P': // ?
chrs += pfenv_print_int(pfenv, va_arg(args, int), 0, 16, 'A', flags, fill, width);
break;
case 'p':
case 'P': // don't bother to handle upcase for 'P'
chrs += pfenv_print_int(pfenv, va_arg(args, mp_uint_t), 0, 16, 'a', flags, fill, width);
break;
#if MICROPY_PY_BUILTINS_FLOAT
case 'e':
case 'E':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment