mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 02:27:19 +02:00
LibCrypto: Add SignedBigInteger::negated_value()
Return the negated value of the current number.
This commit is contained in:
committed by
Sam Atkins
parent
42db468ef5
commit
d589898f5b
Notes:
sideshowbarker
2024-07-17 07:09:23 +09:00
Author: https://github.com/LucasChollet Commit: https://github.com/SerenityOS/serenity/commit/d589898f5b Pull-request: https://github.com/SerenityOS/serenity/pull/14529 Reviewed-by: https://github.com/AtkinsSJ ✅ Reviewed-by: https://github.com/kleinesfilmroellchen
@@ -292,6 +292,13 @@ FLATTEN SignedDivisionResult SignedBigInteger::divided_by(SignedBigInteger const
|
||||
};
|
||||
}
|
||||
|
||||
FLATTEN SignedBigInteger SignedBigInteger::negated_value() const
|
||||
{
|
||||
auto result { *this };
|
||||
result.negate();
|
||||
return result;
|
||||
}
|
||||
|
||||
u32 SignedBigInteger::hash() const
|
||||
{
|
||||
return m_unsigned_data.hash() * (1 - (2 * m_sign));
|
||||
|
||||
Reference in New Issue
Block a user