diff options
author | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2019-04-02 09:03:25 +0200 |
---|---|---|
committer | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2019-04-02 09:03:25 +0200 |
commit | 8fb2d1a49443767ce353520ea045383430a2655e (patch) | |
tree | fc3f737acca869af517f213214f19f8bc78d50d3 /test/monniaux/ternary/ternary.c | |
parent | ff67146a6e1c7ee9c202b5e770706415f45a674d (diff) | |
parent | 629252b160fd4b909231bcad6edcf6f254aca0d6 (diff) | |
download | compcert-kvx-8fb2d1a49443767ce353520ea045383430a2655e.tar.gz compcert-kvx-8fb2d1a49443767ce353520ea045383430a2655e.zip |
Merge branch 'mppa-ternary' of gricad-gitlab.univ-grenoble-alpes.fr:sixcy/CompCert into mppa-ternary
Diffstat (limited to 'test/monniaux/ternary/ternary.c')
-rw-r--r-- | test/monniaux/ternary/ternary.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/test/monniaux/ternary/ternary.c b/test/monniaux/ternary/ternary.c index 45201ff8..79025639 100644 --- a/test/monniaux/ternary/ternary.c +++ b/test/monniaux/ternary/ternary.c @@ -5,10 +5,16 @@ typedef uint32_t data; +#if 0 +#define TERNARY(a, b, c) ((a) ? (b) : (c)) +#else +#define TERNARY(a, b, c) (((-(a)) & (b)) | ((-1+(a)) & (c))) +#endif + data silly_computation(void) { data x = 1; for(int i=0; i<10000; i++) { - x = x * (((x & 0x100) != 0) ? 45561U : 337777U); + x = x * TERNARY(((x & 0x100) != 0), 45561U, 337777U); } return x; } |