mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibCrypto: Make UnsignedBigInteger as fast as architecturally possible
This commit attempts to make UnsignedBigInteger as fast as possible without changing the underlaying architecture. This effort involves - Preallocating space for vector operations - Avoiding calls to computationally expensive functions - Inlining or flattening functions (sensibly)
This commit is contained in:
committed by
Andreas Kling
parent
4d932ce701
commit
c9321b4f00
Notes:
sideshowbarker
2024-07-19 07:03:42 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/c9321b4f009 Pull-request: https://github.com/SerenityOS/serenity/pull/1661 Reviewed-by: https://github.com/Dexesttp Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/itamar8910
@@ -34,7 +34,7 @@
|
||||
namespace Crypto {
|
||||
|
||||
struct UnsignedDivisionResult;
|
||||
constexpr size_t STARTING_WORD_SIZE = 128;
|
||||
constexpr size_t STARTING_WORD_SIZE = 512;
|
||||
|
||||
class UnsignedBigInteger {
|
||||
public:
|
||||
@@ -86,8 +86,8 @@ public:
|
||||
String to_base10() const;
|
||||
|
||||
private:
|
||||
UnsignedBigInteger shift_left_by_n_words(const size_t number_of_words) const;
|
||||
u32 shift_left_get_one_word(const size_t num_bits, const size_t result_word_index) const;
|
||||
ALWAYS_INLINE UnsignedBigInteger shift_left_by_n_words(const size_t number_of_words) const;
|
||||
ALWAYS_INLINE u32 shift_left_get_one_word(const size_t num_bits, const size_t result_word_index) const;
|
||||
|
||||
static constexpr size_t BITS_IN_WORD = 32;
|
||||
AK::Vector<u32, STARTING_WORD_SIZE> m_words;
|
||||
|
||||
Reference in New Issue
Block a user