aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux/bitsliced-tea/bstea.c
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-03-29 06:57:23 +0100
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-03-29 06:57:23 +0100
commit38c676f5591b53f34eb96eb1772bb6165763263d (patch)
treec0efafd8de25a1753ec71efa2cf263cd939b065f /test/monniaux/bitsliced-tea/bstea.c
parentcea4f858490678f6cc1eeddec04f7ed5dc9f5c19 (diff)
downloadcompcert-kvx-38c676f5591b53f34eb96eb1772bb6165763263d.tar.gz
compcert-kvx-38c676f5591b53f34eb96eb1772bb6165763263d.zip
bitsliced-tea slightly more efficient with ternaries at some places
Diffstat (limited to 'test/monniaux/bitsliced-tea/bstea.c')
-rw-r--r--test/monniaux/bitsliced-tea/bstea.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/monniaux/bitsliced-tea/bstea.c b/test/monniaux/bitsliced-tea/bstea.c
index c20c169c..43e29d45 100644
--- a/test/monniaux/bitsliced-tea/bstea.c
+++ b/test/monniaux/bitsliced-tea/bstea.c
@@ -86,7 +86,7 @@ void encrypt(parallel_blocks_t v, const parallel_keys_t k, unsigned int r)
* in the expansion of multiples of 32/golden-ratio,
* or 32/(1+sqrt(5)/2
*/
- ai = (sum & (1<<i)) ? VECTOR_AT_ONE : VECTOR_AT_ZERO;
+ ai = TERNARY((sum & (1<<i)), VECTOR_AT_ONE, VECTOR_AT_ZERO);
bi = v[offset_v1 + i];
aandb = ai & bi;
axorb = ai ^ bi;
@@ -147,7 +147,7 @@ void encrypt(parallel_blocks_t v, const parallel_keys_t k, unsigned int r)
carry = 0;
for (i = 0;i < 32;++i) {
/* VECTOR_AT_ONE where the ith bit of the sum is set */
- ai = (sum & (1<<i)) ? VECTOR_AT_ONE : VECTOR_AT_ZERO;
+ ai = TERNARY((sum & (1<<i)), VECTOR_AT_ONE, VECTOR_AT_ZERO);
bi = v[offset_v0 + i];
aandb = ai & bi;
axorb = ai ^ bi;
@@ -261,7 +261,7 @@ void decrypt(parallel_blocks_t v, const parallel_keys_t k, unsigned int r)
carry = 0;
for (i = 0;i < 32;++i) {
/* VECTOR_AT_ONE where the ith bit of the sum is set */
- ai = (sum & (1<<i)) ? VECTOR_AT_ONE : VECTOR_AT_ZERO;
+ ai = TERNARY((sum & (1<<i)), VECTOR_AT_ONE, VECTOR_AT_ZERO);
bi = v[offset_v0 + i];
aandb = ai & bi;
axorb = ai ^ bi;
@@ -323,7 +323,7 @@ void decrypt(parallel_blocks_t v, const parallel_keys_t k, unsigned int r)
carry = 0;
for (i = 0;i < 32;++i) {
/* VECTOR_AT_ONE where the ith bit of the sum is set */
- ai = (sum & (1<<i)) ? VECTOR_AT_ONE : VECTOR_AT_ZERO;
+ ai = TERNARY((sum & (1<<i)), VECTOR_AT_ONE, VECTOR_AT_ZERO);
bi = v[offset_v1 + i];
aandb = ai & bi;
axorb = ai ^ bi;