1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:07:35 +00:00

LibCrypto: Add SignedBigInteger::negated_value()

Return the negated value of the current number.
This commit is contained in:
Lucas CHOLLET 2022-01-04 16:33:33 +01:00 committed by Sam Atkins
parent 42db468ef5
commit d589898f5b
2 changed files with 9 additions and 0 deletions

View file

@ -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));