mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 04:25:13 +00:00
Everywhere: Remove redundant inline keyword with constexpr
Problem: - `constexpr` functions are additionally decorated with `inline` keyword. This is redundant since `constexpr` implies `inline`. Solution: - Remove redundancies.
This commit is contained in:
parent
42bfaef0bb
commit
ece8aeaaf4
Notes:
sideshowbarker
2024-07-18 19:17:37 +09:00
Author: https://github.com/ldm5180 Commit: https://github.com/SerenityOS/serenity/commit/ece8aeaaf43 Pull-request: https://github.com/SerenityOS/serenity/pull/6536 Reviewed-by: https://github.com/alimpfard
7 changed files with 65 additions and 65 deletions
116
AK/EnumBits.h
116
AK/EnumBits.h
|
@ -40,62 +40,62 @@
|
|||
#define AK_ENUM_BITWISE_FRIEND_OPERATORS(Enum) \
|
||||
_AK_ENUM_BITWISE_OPERATORS_INTERNAL(Enum, friend)
|
||||
|
||||
#define _AK_ENUM_BITWISE_OPERATORS_INTERNAL(Enum, Prefix) \
|
||||
\
|
||||
[[nodiscard]] Prefix constexpr inline Enum operator|(Enum lhs, Enum rhs) \
|
||||
{ \
|
||||
using Type = UnderlyingType<Enum>; \
|
||||
return static_cast<Enum>( \
|
||||
static_cast<Type>(lhs) | static_cast<Type>(rhs)); \
|
||||
} \
|
||||
\
|
||||
[[nodiscard]] Prefix constexpr inline Enum operator&(Enum lhs, Enum rhs) \
|
||||
{ \
|
||||
using Type = UnderlyingType<Enum>; \
|
||||
return static_cast<Enum>( \
|
||||
static_cast<Type>(lhs) & static_cast<Type>(rhs)); \
|
||||
} \
|
||||
\
|
||||
[[nodiscard]] Prefix constexpr inline Enum operator^(Enum lhs, Enum rhs) \
|
||||
{ \
|
||||
using Type = UnderlyingType<Enum>; \
|
||||
return static_cast<Enum>( \
|
||||
static_cast<Type>(lhs) ^ static_cast<Type>(rhs)); \
|
||||
} \
|
||||
\
|
||||
[[nodiscard]] Prefix constexpr inline Enum operator~(Enum rhs) \
|
||||
{ \
|
||||
using Type = UnderlyingType<Enum>; \
|
||||
return static_cast<Enum>( \
|
||||
~static_cast<Type>(rhs)); \
|
||||
} \
|
||||
\
|
||||
Prefix constexpr inline Enum& operator|=(Enum& lhs, Enum rhs) \
|
||||
{ \
|
||||
using Type = UnderlyingType<Enum>; \
|
||||
lhs = static_cast<Enum>( \
|
||||
static_cast<Type>(lhs) | static_cast<Type>(rhs)); \
|
||||
return lhs; \
|
||||
} \
|
||||
\
|
||||
Prefix constexpr inline Enum& operator&=(Enum& lhs, Enum rhs) \
|
||||
{ \
|
||||
using Type = UnderlyingType<Enum>; \
|
||||
lhs = static_cast<Enum>( \
|
||||
static_cast<Type>(lhs) & static_cast<Type>(rhs)); \
|
||||
return lhs; \
|
||||
} \
|
||||
\
|
||||
Prefix constexpr inline Enum& operator^=(Enum& lhs, Enum rhs) \
|
||||
{ \
|
||||
using Type = UnderlyingType<Enum>; \
|
||||
lhs = static_cast<Enum>( \
|
||||
static_cast<Type>(lhs) ^ static_cast<Type>(rhs)); \
|
||||
return lhs; \
|
||||
} \
|
||||
\
|
||||
Prefix constexpr inline bool has_flag(Enum value, Enum mask) \
|
||||
{ \
|
||||
using Type = UnderlyingType<Enum>; \
|
||||
return static_cast<Type>(value & mask) != 0; \
|
||||
#define _AK_ENUM_BITWISE_OPERATORS_INTERNAL(Enum, Prefix) \
|
||||
\
|
||||
[[nodiscard]] Prefix constexpr Enum operator|(Enum lhs, Enum rhs) \
|
||||
{ \
|
||||
using Type = UnderlyingType<Enum>; \
|
||||
return static_cast<Enum>( \
|
||||
static_cast<Type>(lhs) | static_cast<Type>(rhs)); \
|
||||
} \
|
||||
\
|
||||
[[nodiscard]] Prefix constexpr Enum operator&(Enum lhs, Enum rhs) \
|
||||
{ \
|
||||
using Type = UnderlyingType<Enum>; \
|
||||
return static_cast<Enum>( \
|
||||
static_cast<Type>(lhs) & static_cast<Type>(rhs)); \
|
||||
} \
|
||||
\
|
||||
[[nodiscard]] Prefix constexpr Enum operator^(Enum lhs, Enum rhs) \
|
||||
{ \
|
||||
using Type = UnderlyingType<Enum>; \
|
||||
return static_cast<Enum>( \
|
||||
static_cast<Type>(lhs) ^ static_cast<Type>(rhs)); \
|
||||
} \
|
||||
\
|
||||
[[nodiscard]] Prefix constexpr Enum operator~(Enum rhs) \
|
||||
{ \
|
||||
using Type = UnderlyingType<Enum>; \
|
||||
return static_cast<Enum>( \
|
||||
~static_cast<Type>(rhs)); \
|
||||
} \
|
||||
\
|
||||
Prefix constexpr Enum& operator|=(Enum& lhs, Enum rhs) \
|
||||
{ \
|
||||
using Type = UnderlyingType<Enum>; \
|
||||
lhs = static_cast<Enum>( \
|
||||
static_cast<Type>(lhs) | static_cast<Type>(rhs)); \
|
||||
return lhs; \
|
||||
} \
|
||||
\
|
||||
Prefix constexpr Enum& operator&=(Enum& lhs, Enum rhs) \
|
||||
{ \
|
||||
using Type = UnderlyingType<Enum>; \
|
||||
lhs = static_cast<Enum>( \
|
||||
static_cast<Type>(lhs) & static_cast<Type>(rhs)); \
|
||||
return lhs; \
|
||||
} \
|
||||
\
|
||||
Prefix constexpr Enum& operator^=(Enum& lhs, Enum rhs) \
|
||||
{ \
|
||||
using Type = UnderlyingType<Enum>; \
|
||||
lhs = static_cast<Enum>( \
|
||||
static_cast<Type>(lhs) ^ static_cast<Type>(rhs)); \
|
||||
return lhs; \
|
||||
} \
|
||||
\
|
||||
Prefix constexpr bool has_flag(Enum value, Enum mask) \
|
||||
{ \
|
||||
using Type = UnderlyingType<Enum>; \
|
||||
return static_cast<Type>(value & mask) != 0; \
|
||||
}
|
||||
|
|
|
@ -432,10 +432,10 @@ void dmesgln(CheckedFormatString<Parameters...>&& fmt, const Parameters&... para
|
|||
#endif
|
||||
|
||||
template<typename T, typename = void>
|
||||
inline constexpr bool HasFormatter = true;
|
||||
constexpr bool HasFormatter = true;
|
||||
|
||||
template<typename T>
|
||||
inline constexpr bool HasFormatter<T, typename Formatter<T>::__no_formatter_defined> = false;
|
||||
constexpr bool HasFormatter<T, typename Formatter<T>::__no_formatter_defined> = false;
|
||||
|
||||
template<typename T>
|
||||
class FormatIfSupported {
|
||||
|
|
|
@ -72,7 +72,7 @@ enum class ReadError {
|
|||
#undef E
|
||||
};
|
||||
|
||||
inline constexpr ParserBehaviour default_behaviours()
|
||||
constexpr ParserBehaviour default_behaviours()
|
||||
{
|
||||
return ParserBehaviour::QuoteOnlyInFieldStart;
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ enum class WriteError {
|
|||
#undef E
|
||||
};
|
||||
|
||||
inline constexpr WriterBehaviour default_behaviours()
|
||||
constexpr WriterBehaviour default_behaviours()
|
||||
{
|
||||
return WriterBehaviour::None;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
namespace Crypto {
|
||||
namespace Hash {
|
||||
|
||||
inline static constexpr auto ROTATE_LEFT(u32 value, size_t bits)
|
||||
static constexpr auto ROTATE_LEFT(u32 value, size_t bits)
|
||||
{
|
||||
return (value << bits) | (value >> (32 - bits));
|
||||
}
|
||||
|
|
|
@ -319,7 +319,7 @@ private:
|
|||
RGBA32 m_value { 0 };
|
||||
};
|
||||
|
||||
inline constexpr Color::Color(NamedColor named)
|
||||
constexpr Color::Color(NamedColor named)
|
||||
{
|
||||
if (named == Transparent) {
|
||||
m_value = 0;
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
namespace Gfx {
|
||||
|
||||
template<size_t N, typename T>
|
||||
inline static constexpr void normalize(Matrix<N, T>& matrix)
|
||||
static constexpr void normalize(Matrix<N, T>& matrix)
|
||||
{
|
||||
auto sum = 0.0f;
|
||||
for (size_t i = 0; i < matrix.Size; ++i) {
|
||||
|
|
Loading…
Add table
Reference in a new issue