diff options
| author | David Lamparter <equinox@diac24.net> | 2019-05-12 21:11:19 +0200 |
|---|---|---|
| committer | David Lamparter <equinox@diac24.net> | 2019-06-03 16:44:24 +0200 |
| commit | 32b67a0aeb001d3974f432becd8c8783c7ed6d53 (patch) | |
| tree | 9a9b0c0d53762648804dfc03cbf2a81abacea55d /lib/printf/vfprintf.c | |
| parent | 7fa480984edc26617bc3c6bc4d9bc62d3b299a67 (diff) | |
lib/printf: add %Ld/%Lu for int64_t/uint64_t
[u]int64_t is the only type in the intX_t family that needs
special-casing for printf since the calling convention may differ
between 32-bit and 64-bit systems.
Adding the L specifier allows us to eschew the gnarly-looking PRIu64.
Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'lib/printf/vfprintf.c')
| -rw-r--r-- | lib/printf/vfprintf.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/printf/vfprintf.c b/lib/printf/vfprintf.c index 58412a48ce..8c26c2f7c5 100644 --- a/lib/printf/vfprintf.c +++ b/lib/printf/vfprintf.c @@ -224,14 +224,16 @@ __vfprintf(FILE *fp, const char *fmt0, va_list ap) flags&SHORTINT ? (u_long)(u_short)GETARG(int) : \ flags&CHARINT ? (u_long)(u_char)GETARG(int) : \ (u_long)GETARG(u_int)) -#define INTMAX_SIZE (INTMAXT|SIZET|PTRDIFFT|LLONGINT) +#define INTMAX_SIZE (INTMAXT|SIZET|PTRDIFFT|LLONGINT|LONGDBL) #define SJARG() \ - (flags&INTMAXT ? GETARG(intmax_t) : \ + (flags&LONGDBL ? GETARG(int64_t) : \ + flags&INTMAXT ? GETARG(intmax_t) : \ flags&SIZET ? (intmax_t)GETARG(ssize_t) : \ flags&PTRDIFFT ? (intmax_t)GETARG(ptrdiff_t) : \ (intmax_t)GETARG(long long)) #define UJARG() \ - (flags&INTMAXT ? GETARG(uintmax_t) : \ + (flags&LONGDBL ? GETARG(uint64_t) : \ + flags&INTMAXT ? GETARG(uintmax_t) : \ flags&SIZET ? (uintmax_t)GETARG(size_t) : \ flags&PTRDIFFT ? (uintmax_t)GETARG(ptrdiff_t) : \ (uintmax_t)GETARG(unsigned long long)) @@ -377,11 +379,9 @@ reswitch: switch (ch) { } width = n; goto reswitch; -#ifndef NO_FLOATING_POINT case 'L': flags |= LONGDBL; goto rflag; -#endif case 'h': if (flags & SHORTINT) { flags &= ~SHORTINT; |
