LibCrypto: Change static constexpr array to function local constexpr
Problem: - Static variables take memory and can be subject to less optimization (https://serenityos.godbolt.org/z/7EYebr1aa) - 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
751ad19c86
commit
6bc3ed6266
Notes:
sideshowbarker
2024-07-18 17:55:51 +09:00
Author: https://github.com/ldm5180 Commit: https://github.com/SerenityOS/serenity/commit/6bc3ed62669 Pull-request: https://github.com/SerenityOS/serenity/pull/7216
1 changed files with 4 additions and 3 deletions
|
@ -6,11 +6,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Array.h>
|
||||
#include <AK/Random.h>
|
||||
#include <LibCrypto/PK/Code/Code.h>
|
||||
|
||||
static constexpr u8 zeros[] { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
namespace Crypto {
|
||||
namespace PK {
|
||||
|
||||
|
@ -44,7 +43,9 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
m_buffer.overwrite(0, zeros, 8);
|
||||
constexpr Array<u8, 8> zeros {};
|
||||
|
||||
m_buffer.overwrite(0, zeros.data(), 8);
|
||||
m_buffer.overwrite(8, message_hash.data, HashFunction::DigestSize);
|
||||
m_buffer.overwrite(8 + HashFunction::DigestSize, salt, SaltLength);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue