mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:47:46 +00:00
Everywhere: Redundant inline specifier on constexpr functions (#3807)
Problem: - `constexpr` functions are decorated with the `inline` specifier keyword. This is redundant because `constexpr` functions are implicitly `inline`. - [dcl.constexpr], §7.1.5/2 in the C++11 standard): "constexpr functions and constexpr constructors are implicitly inline (7.1.2)". Solution: - Remove the redundant `inline` keyword.
This commit is contained in:
parent
a40abd6ce3
commit
d1fe6a0b53
13 changed files with 43 additions and 43 deletions
|
@ -27,37 +27,37 @@
|
|||
#include <AK/Types.h>
|
||||
#include <LibCrypto/Hash/MD5.h>
|
||||
|
||||
static constexpr inline u32 F(u32 x, u32 y, u32 z) { return (x & y) | ((~x) & z); };
|
||||
static constexpr inline u32 G(u32 x, u32 y, u32 z) { return (x & z) | ((~z) & y); };
|
||||
static constexpr inline u32 H(u32 x, u32 y, u32 z) { return x ^ y ^ z; };
|
||||
static constexpr inline u32 I(u32 x, u32 y, u32 z) { return y ^ (x | ~z); };
|
||||
static constexpr inline u32 ROTATE_LEFT(u32 x, size_t n)
|
||||
static constexpr u32 F(u32 x, u32 y, u32 z) { return (x & y) | ((~x) & z); };
|
||||
static constexpr u32 G(u32 x, u32 y, u32 z) { return (x & z) | ((~z) & y); };
|
||||
static constexpr u32 H(u32 x, u32 y, u32 z) { return x ^ y ^ z; };
|
||||
static constexpr u32 I(u32 x, u32 y, u32 z) { return y ^ (x | ~z); };
|
||||
static constexpr u32 ROTATE_LEFT(u32 x, size_t n)
|
||||
{
|
||||
return (x << n) | (x >> (32 - n));
|
||||
}
|
||||
|
||||
static constexpr inline void round_1(u32& a, u32 b, u32 c, u32 d, u32 x, u32 s, u32 ac)
|
||||
static constexpr void round_1(u32& a, u32 b, u32 c, u32 d, u32 x, u32 s, u32 ac)
|
||||
{
|
||||
a += F(b, c, d) + x + ac;
|
||||
a = ROTATE_LEFT(a, s);
|
||||
a += b;
|
||||
}
|
||||
|
||||
static constexpr inline void round_2(u32& a, u32 b, u32 c, u32 d, u32 x, u32 s, u32 ac)
|
||||
static constexpr void round_2(u32& a, u32 b, u32 c, u32 d, u32 x, u32 s, u32 ac)
|
||||
{
|
||||
a += G(b, c, d) + x + ac;
|
||||
a = ROTATE_LEFT(a, s);
|
||||
a += b;
|
||||
}
|
||||
|
||||
static constexpr inline void round_3(u32& a, u32 b, u32 c, u32 d, u32 x, u32 s, u32 ac)
|
||||
static constexpr void round_3(u32& a, u32 b, u32 c, u32 d, u32 x, u32 s, u32 ac)
|
||||
{
|
||||
a += H(b, c, d) + x + ac;
|
||||
a = ROTATE_LEFT(a, s);
|
||||
a += b;
|
||||
}
|
||||
|
||||
static constexpr inline void round_4(u32& a, u32 b, u32 c, u32 d, u32 x, u32 s, u32 ac)
|
||||
static constexpr void round_4(u32& a, u32 b, u32 c, u32 d, u32 x, u32 s, u32 ac)
|
||||
{
|
||||
a += I(b, c, d) + x + ac;
|
||||
a = ROTATE_LEFT(a, s);
|
||||
|
|
|
@ -29,21 +29,21 @@
|
|||
|
||||
namespace Crypto {
|
||||
namespace Hash {
|
||||
constexpr inline static auto ROTRIGHT(u32 a, size_t b) { return (a >> b) | (a << (32 - b)); }
|
||||
constexpr inline static auto CH(u32 x, u32 y, u32 z) { return (x & y) ^ (z & ~x); }
|
||||
constexpr inline static auto MAJ(u32 x, u32 y, u32 z) { return (x & y) ^ (x & z) ^ (y & z); }
|
||||
constexpr inline static auto EP0(u32 x) { return ROTRIGHT(x, 2) ^ ROTRIGHT(x, 13) ^ ROTRIGHT(x, 22); }
|
||||
constexpr inline static auto EP1(u32 x) { return ROTRIGHT(x, 6) ^ ROTRIGHT(x, 11) ^ ROTRIGHT(x, 25); }
|
||||
constexpr inline static auto SIGN0(u32 x) { return ROTRIGHT(x, 7) ^ ROTRIGHT(x, 18) ^ (x >> 3); }
|
||||
constexpr inline static auto SIGN1(u32 x) { return ROTRIGHT(x, 17) ^ ROTRIGHT(x, 19) ^ (x >> 10); }
|
||||
constexpr static auto ROTRIGHT(u32 a, size_t b) { return (a >> b) | (a << (32 - b)); }
|
||||
constexpr static auto CH(u32 x, u32 y, u32 z) { return (x & y) ^ (z & ~x); }
|
||||
constexpr static auto MAJ(u32 x, u32 y, u32 z) { return (x & y) ^ (x & z) ^ (y & z); }
|
||||
constexpr static auto EP0(u32 x) { return ROTRIGHT(x, 2) ^ ROTRIGHT(x, 13) ^ ROTRIGHT(x, 22); }
|
||||
constexpr static auto EP1(u32 x) { return ROTRIGHT(x, 6) ^ ROTRIGHT(x, 11) ^ ROTRIGHT(x, 25); }
|
||||
constexpr static auto SIGN0(u32 x) { return ROTRIGHT(x, 7) ^ ROTRIGHT(x, 18) ^ (x >> 3); }
|
||||
constexpr static auto SIGN1(u32 x) { return ROTRIGHT(x, 17) ^ ROTRIGHT(x, 19) ^ (x >> 10); }
|
||||
|
||||
constexpr inline static auto ROTRIGHT(u64 a, size_t b) { return (a >> b) | (a << (64 - b)); }
|
||||
constexpr inline static auto CH(u64 x, u64 y, u64 z) { return (x & y) ^ (z & ~x); }
|
||||
constexpr inline static auto MAJ(u64 x, u64 y, u64 z) { return (x & y) ^ (x & z) ^ (y & z); }
|
||||
constexpr inline static auto EP0(u64 x) { return ROTRIGHT(x, 28) ^ ROTRIGHT(x, 34) ^ ROTRIGHT(x, 39); }
|
||||
constexpr inline static auto EP1(u64 x) { return ROTRIGHT(x, 14) ^ ROTRIGHT(x, 18) ^ ROTRIGHT(x, 41); }
|
||||
constexpr inline static auto SIGN0(u64 x) { return ROTRIGHT(x, 1) ^ ROTRIGHT(x, 8) ^ (x >> 7); }
|
||||
constexpr inline static auto SIGN1(u64 x) { return ROTRIGHT(x, 19) ^ ROTRIGHT(x, 61) ^ (x >> 6); }
|
||||
constexpr static auto ROTRIGHT(u64 a, size_t b) { return (a >> b) | (a << (64 - b)); }
|
||||
constexpr static auto CH(u64 x, u64 y, u64 z) { return (x & y) ^ (z & ~x); }
|
||||
constexpr static auto MAJ(u64 x, u64 y, u64 z) { return (x & y) ^ (x & z) ^ (y & z); }
|
||||
constexpr static auto EP0(u64 x) { return ROTRIGHT(x, 28) ^ ROTRIGHT(x, 34) ^ ROTRIGHT(x, 39); }
|
||||
constexpr static auto EP1(u64 x) { return ROTRIGHT(x, 14) ^ ROTRIGHT(x, 18) ^ ROTRIGHT(x, 41); }
|
||||
constexpr static auto SIGN0(u64 x) { return ROTRIGHT(x, 1) ^ ROTRIGHT(x, 8) ^ (x >> 7); }
|
||||
constexpr static auto SIGN1(u64 x) { return ROTRIGHT(x, 19) ^ ROTRIGHT(x, 61) ^ (x >> 6); }
|
||||
|
||||
inline void SHA256::transform(const u8* data)
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ namespace Gfx {
|
|||
enum class ColorRole;
|
||||
typedef u32 RGBA32;
|
||||
|
||||
inline constexpr u32 make_rgb(u8 r, u8 g, u8 b)
|
||||
constexpr u32 make_rgb(u8 r, u8 g, u8 b)
|
||||
{
|
||||
return ((r << 16) | (g << 8) | b);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ struct TypeTrivia {
|
|||
};
|
||||
|
||||
template<typename T, typename U>
|
||||
inline constexpr T sign_extended_to(U value)
|
||||
constexpr T sign_extended_to(U value)
|
||||
{
|
||||
if (!(value & TypeTrivia<U>::sign_bit))
|
||||
return value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue