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

Everywhere: Run clang-format

This commit is contained in:
Idan Horowitz 2022-04-01 20:58:27 +03:00 committed by Linus Groh
parent 0376c127f6
commit 086969277e
1665 changed files with 8479 additions and 8479 deletions

View file

@ -9,7 +9,7 @@
namespace Crypto {
SignedBigInteger SignedBigInteger::import_data(const u8* ptr, size_t length)
SignedBigInteger SignedBigInteger::import_data(u8 const* ptr, size_t length)
{
bool sign = *ptr;
auto unsigned_data = UnsignedBigInteger::import_data(ptr + 1, length - 1);
@ -71,7 +71,7 @@ double SignedBigInteger::to_double() const
return -unsigned_value;
}
FLATTEN SignedBigInteger SignedBigInteger::plus(const SignedBigInteger& other) const
FLATTEN SignedBigInteger SignedBigInteger::plus(SignedBigInteger const& other) const
{
// If both are of the same sign, just add the unsigned data and return.
if (m_sign == other.m_sign)
@ -81,7 +81,7 @@ FLATTEN SignedBigInteger SignedBigInteger::plus(const SignedBigInteger& other) c
return m_sign ? other.minus(this->m_unsigned_data) : minus(other.m_unsigned_data);
}
FLATTEN SignedBigInteger SignedBigInteger::minus(const SignedBigInteger& other) const
FLATTEN SignedBigInteger SignedBigInteger::minus(SignedBigInteger const& other) const
{
// If the signs are different, convert the op to an addition.
if (m_sign != other.m_sign) {
@ -120,7 +120,7 @@ FLATTEN SignedBigInteger SignedBigInteger::minus(const SignedBigInteger& other)
return SignedBigInteger { 0 };
}
FLATTEN SignedBigInteger SignedBigInteger::plus(const UnsignedBigInteger& other) const
FLATTEN SignedBigInteger SignedBigInteger::plus(UnsignedBigInteger const& other) const
{
if (m_sign) {
if (other < m_unsigned_data)
@ -132,7 +132,7 @@ FLATTEN SignedBigInteger SignedBigInteger::plus(const UnsignedBigInteger& other)
return { m_unsigned_data.plus(other), false };
}
FLATTEN SignedBigInteger SignedBigInteger::minus(const UnsignedBigInteger& other) const
FLATTEN SignedBigInteger SignedBigInteger::minus(UnsignedBigInteger const& other) const
{
if (m_sign)
return { m_unsigned_data.plus(m_unsigned_data), true };
@ -167,7 +167,7 @@ FLATTEN SignedDivisionResult SignedBigInteger::divided_by(UnsignedBigInteger con
};
}
FLATTEN SignedBigInteger SignedBigInteger::bitwise_or(const SignedBigInteger& other) const
FLATTEN SignedBigInteger SignedBigInteger::bitwise_or(SignedBigInteger const& other) const
{
// See bitwise_and() for derivations.
if (!is_negative() && !other.is_negative())
@ -191,7 +191,7 @@ FLATTEN SignedBigInteger SignedBigInteger::bitwise_or(const SignedBigInteger& ot
return { unsigned_value().minus(1).bitwise_and(other.unsigned_value().minus(1)).plus(1), true };
}
FLATTEN SignedBigInteger SignedBigInteger::bitwise_and(const SignedBigInteger& other) const
FLATTEN SignedBigInteger SignedBigInteger::bitwise_and(SignedBigInteger const& other) const
{
if (!is_negative() && !other.is_negative())
return { unsigned_value().bitwise_and(other.unsigned_value()), false };
@ -229,33 +229,33 @@ FLATTEN SignedBigInteger SignedBigInteger::bitwise_and(const SignedBigInteger& o
return { unsigned_value().minus(1).bitwise_or(other.unsigned_value().minus(1)).plus(1), true };
}
FLATTEN SignedBigInteger SignedBigInteger::bitwise_xor(const SignedBigInteger& other) const
FLATTEN SignedBigInteger SignedBigInteger::bitwise_xor(SignedBigInteger const& other) const
{
return bitwise_or(other).minus(bitwise_and(other));
}
bool SignedBigInteger::operator==(const UnsignedBigInteger& other) const
bool SignedBigInteger::operator==(UnsignedBigInteger const& other) const
{
if (m_sign)
return false;
return m_unsigned_data == other;
}
bool SignedBigInteger::operator!=(const UnsignedBigInteger& other) const
bool SignedBigInteger::operator!=(UnsignedBigInteger const& other) const
{
if (m_sign)
return true;
return m_unsigned_data != other;
}
bool SignedBigInteger::operator<(const UnsignedBigInteger& other) const
bool SignedBigInteger::operator<(UnsignedBigInteger const& other) const
{
if (m_sign)
return true;
return m_unsigned_data < other;
}
bool SignedBigInteger::operator>(const UnsignedBigInteger& other) const
bool SignedBigInteger::operator>(UnsignedBigInteger const& other) const
{
return *this != other && !(*this < other);
}
@ -265,13 +265,13 @@ FLATTEN SignedBigInteger SignedBigInteger::shift_left(size_t num_bits) const
return SignedBigInteger { m_unsigned_data.shift_left(num_bits), m_sign };
}
FLATTEN SignedBigInteger SignedBigInteger::multiplied_by(const SignedBigInteger& other) const
FLATTEN SignedBigInteger SignedBigInteger::multiplied_by(SignedBigInteger const& other) const
{
bool result_sign = m_sign ^ other.m_sign;
return { m_unsigned_data.multiplied_by(other.m_unsigned_data), result_sign };
}
FLATTEN SignedDivisionResult SignedBigInteger::divided_by(const SignedBigInteger& divisor) const
FLATTEN SignedDivisionResult SignedBigInteger::divided_by(SignedBigInteger const& divisor) const
{
// Aa / Bb -> (A^B)q, Ar
bool result_sign = m_sign ^ divisor.m_sign;
@ -292,7 +292,7 @@ void SignedBigInteger::set_bit_inplace(size_t bit_index)
m_unsigned_data.set_bit_inplace(bit_index);
}
bool SignedBigInteger::operator==(const SignedBigInteger& other) const
bool SignedBigInteger::operator==(SignedBigInteger const& other) const
{
if (is_invalid() != other.is_invalid())
return false;
@ -303,12 +303,12 @@ bool SignedBigInteger::operator==(const SignedBigInteger& other) const
return m_sign == other.m_sign && m_unsigned_data == other.m_unsigned_data;
}
bool SignedBigInteger::operator!=(const SignedBigInteger& other) const
bool SignedBigInteger::operator!=(SignedBigInteger const& other) const
{
return !(*this == other);
}
bool SignedBigInteger::operator<(const SignedBigInteger& other) const
bool SignedBigInteger::operator<(SignedBigInteger const& other) const
{
if (m_sign ^ other.m_sign)
return m_sign;
@ -319,24 +319,24 @@ bool SignedBigInteger::operator<(const SignedBigInteger& other) const
return m_unsigned_data < other.m_unsigned_data;
}
bool SignedBigInteger::operator<=(const SignedBigInteger& other) const
bool SignedBigInteger::operator<=(SignedBigInteger const& other) const
{
return *this < other || *this == other;
}
bool SignedBigInteger::operator>(const SignedBigInteger& other) const
bool SignedBigInteger::operator>(SignedBigInteger const& other) const
{
return *this != other && !(*this < other);
}
bool SignedBigInteger::operator>=(const SignedBigInteger& other) const
bool SignedBigInteger::operator>=(SignedBigInteger const& other) const
{
return !(*this < other);
}
}
ErrorOr<void> AK::Formatter<Crypto::SignedBigInteger>::format(FormatBuilder& fmtbuilder, const Crypto::SignedBigInteger& value)
ErrorOr<void> AK::Formatter<Crypto::SignedBigInteger>::format(FormatBuilder& fmtbuilder, Crypto::SignedBigInteger const& value)
{
if (value.is_negative())
TRY(fmtbuilder.put_string("-"));