Re: [PATCH v2 1/2] tools/nolibc: support left alignment (-) and zero padding (0) in printf
From: David Laight
Date: Fri Jan 30 2026 - 03:01:40 EST
On Fri, 30 Jan 2026 09:05:39 +0800
Cheng Li <im.lechain@xxxxxxxxx> wrote:
> David Laight <david.laight.linux@xxxxxxxxx> 于2026年1月29日周四 18:30写道:
...
> These are great suggestions for a larger refactoring of printf to
> improve performance and standard compliance.
> However, to keep this current change minimal and safe, I prefer to
> focus on fixing the alignment feature first.
>
> @Willy, I will send a v3 that removes the '0' flag handling logic to
> avoid the bug pointed out above.
>
> I will rethink how to implement leading zero pad support.
You made me look at the code.
A simple refactor saved 98 bytes (about 10%).
I will look at adding support for field precision - which is what
is needed for leading zeros.
Will use up some of the saved space, but probably not all of it.
I'll base any patch on top of your change.
David