aboutsummaryrefslogtreecommitdiffstats
path: root/src/stream
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-11-03 22:25:03 +0000
committerlloyd <[email protected]>2010-11-03 22:25:03 +0000
commit860c43c55492b82bf80611d12d9bafce73ad480b (patch)
tree4bd1595a659ead8301f47dfc9826a12adae36efd /src/stream
parent412c50ed41b468b819c817ec3d8858a17284d75b (diff)
Unroll the loop in fixedS to deal with Clang
Diffstat (limited to 'src/stream')
-rw-r--r--src/stream/turing/turing.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/stream/turing/turing.cpp b/src/stream/turing/turing.cpp
index 82e3aa2bb..619ef6682 100644
--- a/src/stream/turing/turing.cpp
+++ b/src/stream/turing/turing.cpp
@@ -210,13 +210,26 @@ void Turing::generate()
*/
u32bit Turing::fixedS(u32bit W)
{
- for(size_t i = 0; i != 4; ++i)
- {
- byte B = SBOX[get_byte(i, W)];
- W ^= rotate_left(Q_BOX[B], i*8);
- W &= rotate_right(0x00FFFFFF, i*8);
- W |= B << (24-i*8);
- }
+ byte B = SBOX[get_byte(0, W)];
+ W ^= Q_BOX[B];
+ W &= 0x00FFFFFF;
+ W |= B << 24;
+
+ B = SBOX[get_byte(1, W)];
+ W ^= rotate_left(Q_BOX[B], 8);
+ W &= 0xFF00FFFF;
+ W |= B << 16;
+
+ B = SBOX[get_byte(2, W)];
+ W ^= rotate_left(Q_BOX[B], 16);
+ W &= 0xFFFF00FF;
+ W |= B << 8;
+
+ B = SBOX[get_byte(3, W)];
+ W ^= rotate_left(Q_BOX[B], 24);
+ W &= 0xFFFFFF00;
+ W |= B;
+
return W;
}