mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-02 04:27:12 +02:00
LibCrypto: Copy the cached hash in SignedBigInteger / UnsignedBigInteger
The hash computation for big integers is pretty expensive, so if we have a cached hash when copying a big int, let's also copy the hash.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
0faf96fa1b
commit
cd73c70ad6
Notes:
github-actions[bot]
2025-07-21 13:23:51 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/cd73c70ad6d Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5543 Reviewed-by: https://github.com/gmta ✅
@@ -47,6 +47,7 @@ SignedBigInteger::SignedBigInteger(i64 value)
|
||||
}
|
||||
|
||||
SignedBigInteger::SignedBigInteger(SignedBigInteger const& other)
|
||||
: m_hash(other.m_hash)
|
||||
{
|
||||
MP_MUST(mp_init_copy(&m_mp, &other.m_mp));
|
||||
}
|
||||
@@ -55,8 +56,11 @@ SignedBigInteger& SignedBigInteger::operator=(SignedBigInteger const& other)
|
||||
{
|
||||
if (this == &other)
|
||||
return *this;
|
||||
|
||||
mp_clear(&m_mp);
|
||||
MP_MUST(mp_init_copy(&m_mp, &other.m_mp));
|
||||
m_hash = other.m_hash;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user