]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
tools/nolibc/printf: Use bit-masks to hold requested flag, length and conversion...
authorDavid Laight <david.laight.linux@gmail.com>
Sun, 8 Mar 2026 11:37:33 +0000 (11:37 +0000)
committerThomas Weißschuh <linux@weissschuh.net>
Fri, 20 Mar 2026 16:46:13 +0000 (17:46 +0100)
commit85f1152778f8cdc563ada12a3fc48c962b408d94
tree2841f093f539c960d58e9c7f454ebd7c837a4a57
parentc5b9173ce9a110618edcb5bd92c8c724b6edf41f
tools/nolibc/printf: Use bit-masks to hold requested flag, length and conversion chars

Use flags bits (1u << (ch & 31)) for the flags, length modifiers, and
conversion specifiers.
This makes it easy to test for multiple values at once.

Detect the conversion flags " #+-0" although they are currently all ignored.

Unconditionally generate the signed values (for %d) to remove a second
set of checks for the size.

Separate out the formatting of single characters from numbers.
Output the sign for negative values then negate and treat as unsigned.

Signed-off-by: David Laight <david.laight.linux@gmail.com>
Acked-by: Willy Tarreau <w@1wt.eu>
Link: https://patch.msgid.link/20260308113742.12649-9-david.laight.linux@gmail.com
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
tools/include/nolibc/stdio.h