[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aYi0eqBb4GDa0Ina@1wt.eu>
Date: Sun, 8 Feb 2026 17:06:18 +0100
From: Willy Tarreau <w@....eu>
To: david.laight.linux@...il.com
Cc: Thomas Weißschuh <linux@...ssschuh.net>,
linux-kernel@...r.kernel.org, Cheng Li <lechain@...il.com>
Subject: Re: [PATCH v2 next 07/11] tools/nolibc/printf: Add support for
conversion flags "#- +" and format "%X"
Another point I didn't notice, which confused me while reading next
patch:
On Fri, Feb 06, 2026 at 07:11:17PM +0000, david.laight.linux@...il.com wrote:
> + if (_NOLIBC_PF_FLAGS_CONTAIN(ch_flag, 'c', 'd', 'i', 'u', 'x', 'p', 's')) {
> unsigned long long v;
> long long signed_v;
> - char *out = tmpbuf;
> + char *out = tmpbuf + 32;
> + int sign = 0;
(...)
> + if (_NOLIBC_PF_FLAGS_CONTAIN(ch_flag, 'p', '#' - 1)) {
> + /* "%p" and "%#x" need "0x" prepending. */
> + sign = 'x' | '0' << 8;
(...)
> + /* Add 0, 1 or 2 ("0x") sign characters left of any zero padding */
> + for (; sign; sign >>= 8) {
> + len++;
> + *--out = sign;
> + }
That's fine, but please mention in front of "sign" declaration something
like "/* may contain more than one char, starting with LSB */".
Willy
Powered by blists - more mailing lists