diff options
author | Lenny Maiorani <lenny@colorado.edu> | 2020-10-20 10:08:13 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-20 18:08:13 +0200 |
commit | d1fe6a0b535169aed22d08463bb92b9ae62b5d15 (patch) | |
tree | 06841235a49af66d66d46033a44c30237cedd39d /Libraries | |
parent | a40abd6ce3a032b1baf52c3573ff02ad658c6e91 (diff) | |
download | serenity-d1fe6a0b535169aed22d08463bb92b9ae62b5d15.zip |
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.
Diffstat (limited to 'Libraries')
-rw-r--r-- | Libraries/LibCrypto/Hash/MD5.cpp | 18 | ||||
-rw-r--r-- | Libraries/LibCrypto/Hash/SHA2.cpp | 30 | ||||
-rw-r--r-- | Libraries/LibGfx/Color.h | 2 | ||||
-rw-r--r-- | Libraries/LibX86/Instruction.h | 2 |
4 files changed, 26 insertions, 26 deletions
diff --git a/Libraries/LibCrypto/Hash/MD5.cpp b/Libraries/LibCrypto/Hash/MD5.cpp index 0cde62d29d..1b2a71d30a 100644 --- a/Libraries/LibCrypto/Hash/MD5.cpp +++ b/Libraries/LibCrypto/Hash/MD5.cpp @@ -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); diff --git a/Libraries/LibCrypto/Hash/SHA2.cpp b/Libraries/LibCrypto/Hash/SHA2.cpp index 60ad8e4a09..72dbdc6d2e 100644 --- a/Libraries/LibCrypto/Hash/SHA2.cpp +++ b/Libraries/LibCrypto/Hash/SHA2.cpp @@ -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 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(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 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) { diff --git a/Libraries/LibGfx/Color.h b/Libraries/LibGfx/Color.h index 09f4bf8529..a935f7af7e 100644 --- a/Libraries/LibGfx/Color.h +++ b/Libraries/LibGfx/Color.h @@ -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); } diff --git a/Libraries/LibX86/Instruction.h b/Libraries/LibX86/Instruction.h index f4425975c4..d943bbfd51 100644 --- a/Libraries/LibX86/Instruction.h +++ b/Libraries/LibX86/Instruction.h @@ -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; |