mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 10:47:35 +00:00
Userland: Change static const variables to static constexpr
`static const` variables can be computed and initialized at run-time during initialization or the first time a function is called. Change them to `static constexpr` to ensure they are computed at compile-time. This allows some removal of `strlen` because the length of the `StringView` can be used which is pre-computed at compile-time.
This commit is contained in:
parent
31515a9147
commit
f912a48315
23 changed files with 111 additions and 82 deletions
|
@ -29,9 +29,9 @@ protected:
|
|||
|
||||
template<typename T>
|
||||
struct TypeTrivia {
|
||||
static const size_t bits = sizeof(T) * 8;
|
||||
static const T sign_bit = 1 << (bits - 1);
|
||||
static const T mask = MakeUnsigned<T>(-1);
|
||||
static constexpr size_t bits = sizeof(T) * 8;
|
||||
static constexpr T sign_bit = 1 << (bits - 1);
|
||||
static constexpr T mask = MakeUnsigned<T>(-1);
|
||||
};
|
||||
|
||||
template<typename T, typename U>
|
||||
|
@ -189,7 +189,7 @@ enum InstructionFormat {
|
|||
OP_NEAR_imm,
|
||||
};
|
||||
|
||||
static const unsigned CurrentAddressSize = 0xB33FBABE;
|
||||
static constexpr unsigned CurrentAddressSize = 0xB33FBABE;
|
||||
|
||||
struct InstructionDescriptor {
|
||||
InstructionHandler handler { nullptr };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue