aboutsummaryrefslogtreecommitdiffstats
path: root/test/monniaux/ternary
diff options
context:
space:
mode:
authorDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-04-05 15:18:50 +0200
committerDavid Monniaux <david.monniaux@univ-grenoble-alpes.fr>2019-04-05 15:18:50 +0200
commit98383707438a3e31ffd86a82b57fbe439945f777 (patch)
tree6e807f70f72f802fb986adfc343410e0609b705f /test/monniaux/ternary
parentcba7f5e13ccea83e60ccfdf1895bef18bf50fe0a (diff)
downloadcompcert-kvx-98383707438a3e31ffd86a82b57fbe439945f777.tar.gz
compcert-kvx-98383707438a3e31ffd86a82b57fbe439945f777.zip
move patterns to include file
Diffstat (limited to 'test/monniaux/ternary')
-rw-r--r--test/monniaux/ternary/ternary.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/test/monniaux/ternary/ternary.c b/test/monniaux/ternary/ternary.c
index 61da9597..ed7de156 100644
--- a/test/monniaux/ternary/ternary.c
+++ b/test/monniaux/ternary/ternary.c
@@ -2,26 +2,14 @@
#include <stdio.h>
#include <inttypes.h>
#include "../clock.h"
+#include "../ternary.h"
typedef uint32_t data;
-static inline int32_t ternary_int32(int32_t a, int32_t b, int32_t c) {
- return (((-((a) == 0)) & (c)) | ((-((a) != 0)) & (b)));
-}
-static inline uint32_t ternary_uint32(uint32_t a, uint32_t b, uint32_t c) {
- return ternary_int32(a, b, c);
-}
-
-#if defined(__COMPCERT__) && defined(__K1C__)
-#define TERNARY(a, b, c) ternary_uint32((a), (b), (c))
-#else
-#define TERNARY(a, b, c) ((a) ? (b) : (c))
-#endif
-
data silly_computation(void) {
data x = 1;
for(int i=0; i<10000; i++) {
- x = x * TERNARY(x & 0x100, 45561U, 337777U);
+ x = x * TERNARY32(x & 0x100, 45561U, 337777U);
}
return x;
}