mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 19:45:12 +00:00
AK: Change static base36 character map to function-local constexpr
Static variables consume memory and can be subject to less optimization. This variable is only used in 1 place and can be moved into the function and make it non-static.
This commit is contained in:
parent
7be79eeb5e
commit
e5d178528d
Notes:
sideshowbarker
2024-07-17 19:04:30 +09:00
Author: https://github.com/ldm5180 Commit: https://github.com/SerenityOS/serenity/commit/e5d178528d Pull-request: https://github.com/SerenityOS/serenity/pull/12388
1 changed files with 3 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Max Wipfli <mail@maxwipfli.ch>
|
||||
* Copyright (c) 2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -162,10 +163,10 @@ constexpr u32 parse_ascii_base36_digit(u32 code_point)
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
static constexpr Array<char, 36> base36_map = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
|
||||
constexpr u32 to_ascii_base36_digit(u32 digit)
|
||||
{
|
||||
VERIFY(digit < 36);
|
||||
constexpr Array<char, 36> base36_map = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
|
||||
VERIFY(digit < base36_map.size());
|
||||
return base36_map[digit];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue