From 83b312141ce29132f99a750a3f6149d152c4990f Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Wed, 2 Feb 2022 14:49:06 -0400 Subject: sux.h: Add third implementation of the `t()` macro. --- sux.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sux.h b/sux.h index b344913..efda8f0 100644 --- a/sux.h +++ b/sux.h @@ -1792,9 +1792,13 @@ static /*inline*/ void exec_base_inst(struct sux *cpu, uint8_t opcode, uint8_t p const uint32_t mask[9] = {w0, w1, w2, w3, w4, w5, w6, w7, w8}; \ if (mask[o8] & o8m) { code } \ } while (0); -#else +#elif 0 #define t(w8, w7, w6, w5, w4, w3, w2, w1, w0) \ if ((const uint32_t [9]){w0, w1, w2, w3, w4, w5, w6, w7, w8}[o8] & o8m) +#else +#define t(w8, w7, w6, w5, w4, w3, w2, w1, w0) \ + if ((o8<1?w0 : o8<2?w1 : o8<3?w2 : o8<4?w3 : \ + o8<5?w4 : o8<6?w5 : o8<7?w6 : o8<8?w7 : w8) & o8m) #endif #define inst(op, ext) \ -- cgit v1.2.3-13-gbd6f