AK: Add format function like std::format or fmt::format.

This commit is contained in:
asynts 2020-09-19 13:47:35 +02:00 committed by Andreas Kling
commit 2bda21318c
Notes: sideshowbarker 2024-07-19 02:17:30 +09:00
4 changed files with 358 additions and 0 deletions

View file

@ -204,6 +204,7 @@ ALWAYS_INLINE int print_double(PutChFunc putch, char*& bufptr, double number, bo
template<typename PutChFunc>
ALWAYS_INLINE int print_i64(PutChFunc putch, char*& bufptr, i64 number, bool left_pad, bool zero_pad, u32 field_width)
{
// FIXME: This won't work if there is padding. ' -17' becomes '- 17'.
if (number < 0) {
putch(bufptr, '-');
return print_u64(putch, bufptr, 0 - number, left_pad, zero_pad, field_width) + 1;