diff options
Diffstat (limited to 'test/monniaux/ternary')
-rw-r--r-- | test/monniaux/ternary/ternary.c | 16 |
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; } |