diff options
author | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2019-03-24 19:35:05 +0100 |
---|---|---|
committer | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2019-03-24 19:35:05 +0100 |
commit | b8b9cd5066b43fea3d3e844c23c64245d36c188c (patch) | |
tree | 529caf2898afbabf90710884834541efb374f6c9 /test/monniaux/bitsliced-aes/bs.c | |
parent | 826a45cc9d3c1f4a12ec764c0f016c38834d1654 (diff) | |
download | compcert-kvx-b8b9cd5066b43fea3d3e844c23c64245d36c188c.tar.gz compcert-kvx-b8b9cd5066b43fea3d3e844c23c64245d36c188c.zip |
some more ternary
Diffstat (limited to 'test/monniaux/bitsliced-aes/bs.c')
-rw-r--r-- | test/monniaux/bitsliced-aes/bs.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/monniaux/bitsliced-aes/bs.c b/test/monniaux/bitsliced-aes/bs.c index f48faefa..4a9df4aa 100644 --- a/test/monniaux/bitsliced-aes/bs.c +++ b/test/monniaux/bitsliced-aes/bs.c @@ -14,6 +14,11 @@ #error "endianness not supported" #endif +#if 1 +#define TERNARY_XY0(t, x) ((-((t) != 0)) & (x)) +#else +#define TERNARY_XY0(t, x) (((t) != 0) ? (x) : (0)) +#endif void bs_addroundkey(word_t * B, word_t * rk) { @@ -391,11 +396,6 @@ void bs_transpose_dst(word_t * transpose, word_t * blocks) /* DM experiments */ /* The normal ternary operator costs us a lot! from 10145951 to 7995063 */ -#if 1 -#define TERNARY_XY0(t, x) ((-((t) != 0)) & (x)) -#else -#define TERNARY_XY0(t, x) (((t) != 0) ? (x) : (0)) -#endif int j; for(j=0; j < WORD_SIZE; j++) { @@ -496,7 +496,7 @@ void bs_transpose_rev(word_t * blocks) int j; for(j=0; j < WORD_SIZE; j++) { - word_t bit = (w & (ONE << j)) ? (ONE << (k % WORD_SIZE)) : 0; + word_t bit = TERNARY_XY0((w & (ONE << j)), (ONE << (k % WORD_SIZE))); transpose[j * WORDS_PER_BLOCK + (offset)] |= bit; } #else |