1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:27:45 +00:00

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
parent b5ca74e78a
commit 2bda21318c
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;