aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/block
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-09-19 11:56:34 -0400
committerJack Lloyd <[email protected]>2018-10-01 12:54:01 -0400
commit2230dd96311c8db3294bf10cf58d739061d26102 (patch)
treee6a42b2c11f6d158cd70243e0bb401f351e3ab94 /src/lib/block
parent8eb900731da945d276f723534af09592213ee582 (diff)
Make a few simple functions constexpr
This is primarily just to verify that C++11 constexpr works.
Diffstat (limited to 'src/lib/block')
-rw-r--r--src/lib/block/aes/aes.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/block/aes/aes.cpp b/src/lib/block/aes/aes.cpp
index c025530a4..0c18e93ee 100644
--- a/src/lib/block/aes/aes.cpp
+++ b/src/lib/block/aes/aes.cpp
@@ -99,15 +99,15 @@ const uint8_t SD[256] = {
0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, 0xE1, 0x69, 0x14, 0x63,
0x55, 0x21, 0x0C, 0x7D };
-inline uint8_t xtime(uint8_t s) { return static_cast<uint8_t>(s << 1) ^ ((s >> 7) * 0x1B); }
-inline uint8_t xtime4(uint8_t s) { return xtime(xtime(s)); }
-inline uint8_t xtime8(uint8_t s) { return xtime(xtime(xtime(s))); }
-
-inline uint8_t xtime3(uint8_t s) { return xtime(s) ^ s; }
-inline uint8_t xtime9(uint8_t s) { return xtime8(s) ^ s; }
-inline uint8_t xtime11(uint8_t s) { return xtime8(s) ^ xtime(s) ^ s; }
-inline uint8_t xtime13(uint8_t s) { return xtime8(s) ^ xtime4(s) ^ s; }
-inline uint8_t xtime14(uint8_t s) { return xtime8(s) ^ xtime4(s) ^ xtime(s); }
+inline constexpr uint8_t xtime(uint8_t s) { return static_cast<uint8_t>(s << 1) ^ ((s >> 7) * 0x1B); }
+inline constexpr uint8_t xtime4(uint8_t s) { return xtime(xtime(s)); }
+inline constexpr uint8_t xtime8(uint8_t s) { return xtime(xtime(xtime(s))); }
+
+inline constexpr uint8_t xtime3(uint8_t s) { return xtime(s) ^ s; }
+inline constexpr uint8_t xtime9(uint8_t s) { return xtime8(s) ^ s; }
+inline constexpr uint8_t xtime11(uint8_t s) { return xtime8(s) ^ xtime(s) ^ s; }
+inline constexpr uint8_t xtime13(uint8_t s) { return xtime8(s) ^ xtime4(s) ^ s; }
+inline constexpr uint8_t xtime14(uint8_t s) { return xtime8(s) ^ xtime4(s) ^ xtime(s); }
inline uint32_t SE_word(uint32_t x)
{