mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:47:35 +00:00
LibCrypto: Add SignedBigInteger::negated_value()
Return the negated value of the current number.
This commit is contained in:
parent
42db468ef5
commit
d589898f5b
2 changed files with 9 additions and 0 deletions
|
@ -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
|
u32 SignedBigInteger::hash() const
|
||||||
{
|
{
|
||||||
return m_unsigned_data.hash() * (1 - (2 * m_sign));
|
return m_unsigned_data.hash() * (1 - (2 * m_sign));
|
||||||
|
|
|
@ -121,6 +121,8 @@ public:
|
||||||
[[nodiscard]] SignedBigInteger multiplied_by(UnsignedBigInteger const& other) const;
|
[[nodiscard]] SignedBigInteger multiplied_by(UnsignedBigInteger const& other) const;
|
||||||
[[nodiscard]] SignedDivisionResult divided_by(UnsignedBigInteger const& divisor) const;
|
[[nodiscard]] SignedDivisionResult divided_by(UnsignedBigInteger const& divisor) const;
|
||||||
|
|
||||||
|
[[nodiscard]] SignedBigInteger negated_value() const;
|
||||||
|
|
||||||
[[nodiscard]] u32 hash() const;
|
[[nodiscard]] u32 hash() const;
|
||||||
|
|
||||||
void set_bit_inplace(size_t bit_index);
|
void set_bit_inplace(size_t bit_index);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue