mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
AK/PrintfImplementation: Change static constexpr array to function local
Problem: - Static variables take memory and can be subject to less optimization. - This static variable is only used in 1 place. Solution: - Move the variable into the function and make it non-static.
This commit is contained in:
parent
3908a49661
commit
44a9c7c23e
Notes:
sideshowbarker
2024-07-18 17:53:37 +09:00
Author: https://github.com/ldm5180 Commit: https://github.com/SerenityOS/serenity/commit/44a9c7c23e2 Pull-request: https://github.com/SerenityOS/serenity/pull/7226
1 changed files with 3 additions and 3 deletions
|
@ -19,9 +19,6 @@ extern "C" size_t strlen(const char*);
|
|||
|
||||
namespace PrintfImplementation {
|
||||
|
||||
static constexpr const char* printf_hex_digits_lower = "0123456789abcdef";
|
||||
static constexpr const char* printf_hex_digits_upper = "0123456789ABCDEF";
|
||||
|
||||
template<typename PutChFunc, typename T>
|
||||
ALWAYS_INLINE int print_hex(PutChFunc putch, char*& bufptr, T number, bool upper_case, bool alternate_form, bool left_pad, bool zero_pad, u8 field_width)
|
||||
{
|
||||
|
@ -64,6 +61,9 @@ ALWAYS_INLINE int print_hex(PutChFunc putch, char*& bufptr, T number, bool upper
|
|||
} else {
|
||||
u8 shift_count = digits * 4;
|
||||
while (shift_count) {
|
||||
constexpr const char* printf_hex_digits_lower = "0123456789abcdef";
|
||||
constexpr const char* printf_hex_digits_upper = "0123456789ABCDEF";
|
||||
|
||||
shift_count -= 4;
|
||||
putch(bufptr,
|
||||
upper_case
|
||||
|
|
Loading…
Reference in a new issue