mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
AK: Zero-pad automatically if formatting with precision
This commit is contained in:
parent
aad9d0aa51
commit
5c511de4cc
Notes:
sideshowbarker
2024-07-17 23:05:54 +09:00
Author: https://github.com/timschumi Commit: https://github.com/SerenityOS/serenity/commit/5c511de4cc0 Pull-request: https://github.com/SerenityOS/serenity/pull/11182
1 changed files with 2 additions and 0 deletions
|
@ -443,6 +443,7 @@ ALWAYS_INLINE int printf_internal(PutChFunc putch, char* buffer, const char*& fm
|
|||
} else {
|
||||
if (!state.has_fraction_length) {
|
||||
state.has_fraction_length = true;
|
||||
state.zero_pad = true;
|
||||
state.fraction_length = 0;
|
||||
}
|
||||
state.fraction_length *= 10;
|
||||
|
@ -454,6 +455,7 @@ ALWAYS_INLINE int printf_internal(PutChFunc putch, char* buffer, const char*& fm
|
|||
if (*p == '*') {
|
||||
if (state.dot) {
|
||||
state.has_fraction_length = true;
|
||||
state.zero_pad = true;
|
||||
state.fraction_length = NextArgument<int>()(ap);
|
||||
} else {
|
||||
state.field_width = NextArgument<int>()(ap);
|
||||
|
|
Loading…
Add table
Reference in a new issue