mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 11:45:06 +00:00
Kernel: Change static constexpr variables to constexpr where possible
Function-local `static constexpr` variables can be `constexpr`. This can reduce memory consumption, binary size, and offer additional compiler optimizations. These changes result in a stripped x86_64 kernel binary size reduction of 592 bytes.
This commit is contained in:
parent
6a4c8a66ae
commit
c6acf64558
11 changed files with 26 additions and 15 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -57,8 +58,8 @@ static bool validate_stack_size(NonnullOwnPtrVector<KString> const& arguments, N
|
|||
total_arguments_size += sizeof(char*) * (arguments.size() + 1);
|
||||
total_environment_size += sizeof(char*) * (environment.size() + 1);
|
||||
|
||||
static constexpr size_t max_arguments_size = Thread::default_userspace_stack_size / 8;
|
||||
static constexpr size_t max_environment_size = Thread::default_userspace_stack_size / 8;
|
||||
constexpr size_t max_arguments_size = Thread::default_userspace_stack_size / 8;
|
||||
constexpr size_t max_environment_size = Thread::default_userspace_stack_size / 8;
|
||||
|
||||
if (total_arguments_size > max_arguments_size)
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue