mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 20:17:13 +02:00
Everywhere: Use Optional<T>::ensure() where useful
No functional changes.
This commit is contained in:
committed by
Tim Flynn
parent
0fe9255991
commit
c31eff6a47
Notes:
github-actions[bot]
2025-09-17 16:02:17 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/c31eff6a47d Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6220 Reviewed-by: https://github.com/rmg-x Reviewed-by: https://github.com/trflynn89 ✅
@@ -360,13 +360,11 @@ FLATTEN SignedBigInteger SignedBigInteger::negated_value() const
|
||||
|
||||
u32 SignedBigInteger::hash() const
|
||||
{
|
||||
if (m_hash.has_value())
|
||||
return *m_hash;
|
||||
|
||||
auto buffer = MUST(ByteBuffer::create_zeroed(byte_length()));
|
||||
auto result = export_data(buffer);
|
||||
m_hash = string_hash(reinterpret_cast<char const*>(result.data()), result.size());
|
||||
return *m_hash;
|
||||
return m_hash.ensure([&] {
|
||||
auto buffer = MUST(ByteBuffer::create_zeroed(byte_length()));
|
||||
auto result = export_data(buffer);
|
||||
return string_hash(reinterpret_cast<char const*>(result.data()), result.size());
|
||||
});
|
||||
}
|
||||
|
||||
bool SignedBigInteger::operator==(SignedBigInteger const& other) const
|
||||
|
||||
Reference in New Issue
Block a user