summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2022-02-02 14:49:06 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2022-02-02 14:49:06 -0400
commit83b312141ce29132f99a750a3f6149d152c4990f (patch)
tree7e861f59d5a53ed04285976964643e2597a8f509
parent2bf356950e14d26885b9a87a274770216f6e99b7 (diff)
sux.h: Add third implementation of the `t()` macro.
-rw-r--r--sux.h6
1 files changed, 5 insertions, 1 deletions
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) \