1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 22:17:44 +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

@ -32,7 +32,7 @@ FLATTEN void UnsignedBigIntegerAlgorithms::bitwise_or_without_allocation(
return;
}
const UnsignedBigInteger *shorter, *longer;
UnsignedBigInteger const *shorter, *longer;
if (left.length() < right.length()) {
shorter = &left;
longer = &right;
@ -71,7 +71,7 @@ FLATTEN void UnsignedBigIntegerAlgorithms::bitwise_and_without_allocation(
return;
}
const UnsignedBigInteger *shorter, *longer;
UnsignedBigInteger const *shorter, *longer;
if (left.length() < right.length()) {
shorter = &left;
longer = &right;
@ -110,7 +110,7 @@ FLATTEN void UnsignedBigIntegerAlgorithms::bitwise_xor_without_allocation(
return;
}
const UnsignedBigInteger *shorter, *longer;
UnsignedBigInteger const *shorter, *longer;
if (left.length() < right.length()) {
shorter = &left;
longer = &right;

View file

@ -17,8 +17,8 @@ void UnsignedBigIntegerAlgorithms::add_without_allocation(
UnsignedBigInteger const& right,
UnsignedBigInteger& output)
{
const UnsignedBigInteger* const longer = (left.length() > right.length()) ? &left : &right;
const UnsignedBigInteger* const shorter = (longer == &right) ? &left : &right;
UnsignedBigInteger const* const longer = (left.length() > right.length()) ? &left : &right;
UnsignedBigInteger const* const shorter = (longer == &right) ? &left : &right;
output.set_to(*longer);
add_into_accumulator_without_allocation(output, *shorter);

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("-"));

View file

@ -45,8 +45,8 @@ public:
return { UnsignedBigInteger::create_invalid(), false };
}
static SignedBigInteger import_data(StringView data) { return import_data((const u8*)data.characters_without_null_termination(), data.length()); }
static SignedBigInteger import_data(const u8* ptr, size_t length);
static SignedBigInteger import_data(StringView data) { return import_data((u8 const*)data.characters_without_null_termination(), data.length()); }
static SignedBigInteger import_data(u8 const* ptr, size_t length);
static SignedBigInteger create_from(i64 value)
{
@ -69,8 +69,8 @@ public:
u64 to_u64() const;
double to_double() const;
const UnsignedBigInteger& unsigned_value() const { return m_unsigned_data; }
const Vector<u32, STARTING_WORD_SIZE> words() const { return m_unsigned_data.words(); }
UnsignedBigInteger const& unsigned_value() const { return m_unsigned_data; }
Vector<u32, STARTING_WORD_SIZE> const words() const { return m_unsigned_data.words(); }
bool is_negative() const { return m_sign; }
void negate()
@ -90,7 +90,7 @@ public:
m_unsigned_data.set_to((u32)other);
m_sign = other < 0;
}
void set_to(const SignedBigInteger& other)
void set_to(SignedBigInteger const& other)
{
m_unsigned_data.set_to(other.m_unsigned_data);
m_sign = other.m_sign;
@ -107,36 +107,36 @@ public:
size_t length() const { return m_unsigned_data.length() + 1; }
size_t trimmed_length() const { return m_unsigned_data.trimmed_length() + 1; };
SignedBigInteger plus(const SignedBigInteger& other) const;
SignedBigInteger minus(const SignedBigInteger& other) const;
SignedBigInteger bitwise_or(const SignedBigInteger& other) const;
SignedBigInteger bitwise_and(const SignedBigInteger& other) const;
SignedBigInteger bitwise_xor(const SignedBigInteger& other) const;
SignedBigInteger plus(SignedBigInteger const& other) const;
SignedBigInteger minus(SignedBigInteger const& other) const;
SignedBigInteger bitwise_or(SignedBigInteger const& other) const;
SignedBigInteger bitwise_and(SignedBigInteger const& other) const;
SignedBigInteger bitwise_xor(SignedBigInteger const& other) const;
SignedBigInteger bitwise_not() const;
SignedBigInteger shift_left(size_t num_bits) const;
SignedBigInteger multiplied_by(const SignedBigInteger& other) const;
SignedDivisionResult divided_by(const SignedBigInteger& divisor) const;
SignedBigInteger multiplied_by(SignedBigInteger const& other) const;
SignedDivisionResult divided_by(SignedBigInteger const& divisor) const;
SignedBigInteger plus(const UnsignedBigInteger& other) const;
SignedBigInteger minus(const UnsignedBigInteger& other) const;
SignedBigInteger multiplied_by(const UnsignedBigInteger& other) const;
SignedDivisionResult divided_by(const UnsignedBigInteger& divisor) const;
SignedBigInteger plus(UnsignedBigInteger const& other) const;
SignedBigInteger minus(UnsignedBigInteger const& other) const;
SignedBigInteger multiplied_by(UnsignedBigInteger const& other) const;
SignedDivisionResult divided_by(UnsignedBigInteger const& divisor) const;
u32 hash() const;
void set_bit_inplace(size_t bit_index);
bool operator==(const SignedBigInteger& other) const;
bool operator!=(const SignedBigInteger& other) const;
bool operator<(const SignedBigInteger& other) const;
bool operator<=(const SignedBigInteger& other) const;
bool operator>(const SignedBigInteger& other) const;
bool operator>=(const SignedBigInteger& other) const;
bool operator==(SignedBigInteger const& other) const;
bool operator!=(SignedBigInteger const& other) const;
bool operator<(SignedBigInteger const& other) const;
bool operator<=(SignedBigInteger const& other) const;
bool operator>(SignedBigInteger const& other) const;
bool operator>=(SignedBigInteger const& other) const;
bool operator==(const UnsignedBigInteger& other) const;
bool operator!=(const UnsignedBigInteger& other) const;
bool operator<(const UnsignedBigInteger& other) const;
bool operator>(const UnsignedBigInteger& other) const;
bool operator==(UnsignedBigInteger const& other) const;
bool operator!=(UnsignedBigInteger const& other) const;
bool operator<(UnsignedBigInteger const& other) const;
bool operator>(UnsignedBigInteger const& other) const;
private:
void ensure_sign_is_valid()
@ -162,7 +162,7 @@ struct AK::Formatter<Crypto::SignedBigInteger> : AK::Formatter<Crypto::UnsignedB
};
inline Crypto::SignedBigInteger
operator""_sbigint(const char* string, size_t length)
operator""_sbigint(char const* string, size_t length)
{
return Crypto::SignedBigInteger::from_base(10, { string, length });
}

View file

@ -13,7 +13,7 @@
namespace Crypto {
UnsignedBigInteger::UnsignedBigInteger(const u8* ptr, size_t length)
UnsignedBigInteger::UnsignedBigInteger(u8 const* ptr, size_t length)
{
m_words.resize_and_keep_capacity((length + sizeof(u32) - 1) / sizeof(u32));
size_t in = length, out = 0;
@ -136,7 +136,7 @@ void UnsignedBigInteger::set_to(UnsignedBigInteger::Word other)
m_cached_hash = 0;
}
void UnsignedBigInteger::set_to(const UnsignedBigInteger& other)
void UnsignedBigInteger::set_to(UnsignedBigInteger const& other)
{
m_is_invalid = other.m_is_invalid;
m_words.resize_and_keep_capacity(other.m_words.size());
@ -195,7 +195,7 @@ size_t UnsignedBigInteger::one_based_index_of_highest_set_bit() const
return index;
}
FLATTEN UnsignedBigInteger UnsignedBigInteger::plus(const UnsignedBigInteger& other) const
FLATTEN UnsignedBigInteger UnsignedBigInteger::plus(UnsignedBigInteger const& other) const
{
UnsignedBigInteger result;
@ -204,7 +204,7 @@ FLATTEN UnsignedBigInteger UnsignedBigInteger::plus(const UnsignedBigInteger& ot
return result;
}
FLATTEN UnsignedBigInteger UnsignedBigInteger::minus(const UnsignedBigInteger& other) const
FLATTEN UnsignedBigInteger UnsignedBigInteger::minus(UnsignedBigInteger const& other) const
{
UnsignedBigInteger result;
@ -213,7 +213,7 @@ FLATTEN UnsignedBigInteger UnsignedBigInteger::minus(const UnsignedBigInteger& o
return result;
}
FLATTEN UnsignedBigInteger UnsignedBigInteger::bitwise_or(const UnsignedBigInteger& other) const
FLATTEN UnsignedBigInteger UnsignedBigInteger::bitwise_or(UnsignedBigInteger const& other) const
{
UnsignedBigInteger result;
@ -222,7 +222,7 @@ FLATTEN UnsignedBigInteger UnsignedBigInteger::bitwise_or(const UnsignedBigInteg
return result;
}
FLATTEN UnsignedBigInteger UnsignedBigInteger::bitwise_and(const UnsignedBigInteger& other) const
FLATTEN UnsignedBigInteger UnsignedBigInteger::bitwise_and(UnsignedBigInteger const& other) const
{
UnsignedBigInteger result;
@ -231,7 +231,7 @@ FLATTEN UnsignedBigInteger UnsignedBigInteger::bitwise_and(const UnsignedBigInte
return result;
}
FLATTEN UnsignedBigInteger UnsignedBigInteger::bitwise_xor(const UnsignedBigInteger& other) const
FLATTEN UnsignedBigInteger UnsignedBigInteger::bitwise_xor(UnsignedBigInteger const& other) const
{
UnsignedBigInteger result;
@ -260,7 +260,7 @@ FLATTEN UnsignedBigInteger UnsignedBigInteger::shift_left(size_t num_bits) const
return output;
}
FLATTEN UnsignedBigInteger UnsignedBigInteger::multiplied_by(const UnsignedBigInteger& other) const
FLATTEN UnsignedBigInteger UnsignedBigInteger::multiplied_by(UnsignedBigInteger const& other) const
{
UnsignedBigInteger result;
UnsignedBigInteger temp_shift_result;
@ -272,7 +272,7 @@ FLATTEN UnsignedBigInteger UnsignedBigInteger::multiplied_by(const UnsignedBigIn
return result;
}
FLATTEN UnsignedDivisionResult UnsignedBigInteger::divided_by(const UnsignedBigInteger& divisor) const
FLATTEN UnsignedDivisionResult UnsignedBigInteger::divided_by(UnsignedBigInteger const& divisor) const
{
UnsignedBigInteger quotient;
UnsignedBigInteger remainder;
@ -299,7 +299,7 @@ u32 UnsignedBigInteger::hash() const
if (m_cached_hash != 0)
return m_cached_hash;
return m_cached_hash = string_hash((const char*)m_words.data(), sizeof(Word) * m_words.size());
return m_cached_hash = string_hash((char const*)m_words.data(), sizeof(Word) * m_words.size());
}
void UnsignedBigInteger::set_bit_inplace(size_t bit_index)
@ -318,7 +318,7 @@ void UnsignedBigInteger::set_bit_inplace(size_t bit_index)
m_cached_hash = 0;
}
bool UnsignedBigInteger::operator==(const UnsignedBigInteger& other) const
bool UnsignedBigInteger::operator==(UnsignedBigInteger const& other) const
{
if (is_invalid() != other.is_invalid())
return false;
@ -331,12 +331,12 @@ bool UnsignedBigInteger::operator==(const UnsignedBigInteger& other) const
return !__builtin_memcmp(m_words.data(), other.words().data(), length * (BITS_IN_WORD / 8));
}
bool UnsignedBigInteger::operator!=(const UnsignedBigInteger& other) const
bool UnsignedBigInteger::operator!=(UnsignedBigInteger const& other) const
{
return !(*this == other);
}
bool UnsignedBigInteger::operator<(const UnsignedBigInteger& other) const
bool UnsignedBigInteger::operator<(UnsignedBigInteger const& other) const
{
auto length = trimmed_length();
auto other_length = other.trimmed_length();
@ -360,7 +360,7 @@ bool UnsignedBigInteger::operator<(const UnsignedBigInteger& other) const
return false;
}
bool UnsignedBigInteger::operator>(const UnsignedBigInteger& other) const
bool UnsignedBigInteger::operator>(UnsignedBigInteger const& other) const
{
return *this != other && !(*this < other);
}
@ -372,7 +372,7 @@ bool UnsignedBigInteger::operator>=(UnsignedBigInteger const& other) const
}
ErrorOr<void> AK::Formatter<Crypto::UnsignedBigInteger>::format(FormatBuilder& fmtbuilder, const Crypto::UnsignedBigInteger& value)
ErrorOr<void> AK::Formatter<Crypto::UnsignedBigInteger>::format(FormatBuilder& fmtbuilder, Crypto::UnsignedBigInteger const& value)
{
if (value.is_invalid())
return Formatter<StringView>::format(fmtbuilder, "invalid");

View file

@ -30,14 +30,14 @@ public:
{
}
explicit UnsignedBigInteger(const u8* ptr, size_t length);
explicit UnsignedBigInteger(u8 const* ptr, size_t length);
UnsignedBigInteger() = default;
static UnsignedBigInteger create_invalid();
static UnsignedBigInteger import_data(StringView data) { return import_data((const u8*)data.characters_without_null_termination(), data.length()); }
static UnsignedBigInteger import_data(const u8* ptr, size_t length)
static UnsignedBigInteger import_data(StringView data) { return import_data((u8 const*)data.characters_without_null_termination(), data.length()); }
static UnsignedBigInteger import_data(u8 const* ptr, size_t length)
{
return UnsignedBigInteger(ptr, length);
}
@ -60,11 +60,11 @@ public:
u64 to_u64() const;
double to_double() const;
const Vector<Word, STARTING_WORD_SIZE>& words() const { return m_words; }
Vector<Word, STARTING_WORD_SIZE> const& words() const { return m_words; }
void set_to_0();
void set_to(Word other);
void set_to(const UnsignedBigInteger& other);
void set_to(UnsignedBigInteger const& other);
void invalidate()
{
@ -86,24 +86,24 @@ public:
size_t one_based_index_of_highest_set_bit() const;
UnsignedBigInteger plus(const UnsignedBigInteger& other) const;
UnsignedBigInteger minus(const UnsignedBigInteger& other) const;
UnsignedBigInteger bitwise_or(const UnsignedBigInteger& other) const;
UnsignedBigInteger bitwise_and(const UnsignedBigInteger& other) const;
UnsignedBigInteger bitwise_xor(const UnsignedBigInteger& other) const;
UnsignedBigInteger plus(UnsignedBigInteger const& other) const;
UnsignedBigInteger minus(UnsignedBigInteger const& other) const;
UnsignedBigInteger bitwise_or(UnsignedBigInteger const& other) const;
UnsignedBigInteger bitwise_and(UnsignedBigInteger const& other) const;
UnsignedBigInteger bitwise_xor(UnsignedBigInteger const& other) const;
UnsignedBigInteger bitwise_not_fill_to_one_based_index(size_t) const;
UnsignedBigInteger shift_left(size_t num_bits) const;
UnsignedBigInteger multiplied_by(const UnsignedBigInteger& other) const;
UnsignedDivisionResult divided_by(const UnsignedBigInteger& divisor) const;
UnsignedBigInteger multiplied_by(UnsignedBigInteger const& other) const;
UnsignedDivisionResult divided_by(UnsignedBigInteger const& divisor) const;
u32 hash() const;
void set_bit_inplace(size_t bit_index);
bool operator==(const UnsignedBigInteger& other) const;
bool operator!=(const UnsignedBigInteger& other) const;
bool operator<(const UnsignedBigInteger& other) const;
bool operator>(const UnsignedBigInteger& other) const;
bool operator==(UnsignedBigInteger const& other) const;
bool operator!=(UnsignedBigInteger const& other) const;
bool operator<(UnsignedBigInteger const& other) const;
bool operator>(UnsignedBigInteger const& other) const;
bool operator>=(UnsignedBigInteger const& other) const;
private:
@ -133,7 +133,7 @@ struct AK::Formatter<Crypto::UnsignedBigInteger> : Formatter<StringView> {
};
inline Crypto::UnsignedBigInteger
operator""_bigint(const char* string, size_t length)
operator""_bigint(char const* string, size_t length)
{
return Crypto::UnsignedBigInteger::from_base(10, { string, length });
}