Jacob Garber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/34027 )
Change subject: console: Implement j specifier in vtxprintf() ......................................................................
console: Implement j specifier in vtxprintf()
It is occasionally useful to print a uintmax_t or intmax_t, so add support for the j specifier. This also makes defining the PRI* macros in <inttypes.h> simpler.
Change-Id: I656e3992029199b48e62a9df2d56f54c34e4e10f Signed-off-by: Jacob Garber jgarber1@ualberta.ca --- M src/console/vtxprintf.c 1 file changed, 5 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/27/34027/1
diff --git a/src/console/vtxprintf.c b/src/console/vtxprintf.c index 01091c8..94e370f 100644 --- a/src/console/vtxprintf.c +++ b/src/console/vtxprintf.c @@ -18,6 +18,7 @@ #include <console/vtxprintf.h> #include <ctype.h> #include <string.h> +#include <stdint.h>
#define call_tx(x) tx_byte(x, data)
@@ -138,7 +139,7 @@ int field_width; /* width of output field */ int precision; /* min. # of digits for integers; max number of chars for from string */ - int qualifier; /* 'h', 'H', 'l', or 'L' for integer fields */ + int qualifier; /* 'h', 'H', 'l', 'L', 'z', or 'j' for integer fields */
int count;
@@ -192,7 +193,7 @@
/* get the conversion qualifier */ qualifier = -1; - if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt == 'z') { + if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt == 'z' || *fmt == 'j') { qualifier = *fmt; ++fmt; if (*fmt == 'l') { @@ -293,6 +294,8 @@ num = va_arg(args, unsigned long); } else if (qualifier == 'z') { num = va_arg(args, size_t); + } else if (qualifier == 'j') { + num = va_arg(args, uintmax_t); } else if (qualifier == 'h') { num = (unsigned short) va_arg(args, int); if (flags & SIGN)