diff options
author | comex | 2015-01-11 15:33:25 -0500 |
---|---|---|
committer | comex | 2015-01-11 15:33:25 -0500 |
commit | 4743027a22ae4e622d7e78f878eff307d02ac373 (patch) | |
tree | de3c834fa1812bf194948b466074c7626b878227 /test | |
parent | yay? (diff) | |
download | substitute-4743027a22ae4e622d7e78f878eff307d02ac373.tar.gz |
C++ is just a giant pain in the ass
Diffstat (limited to 'test')
-rw-r--r-- | test/test-dis.c | 8 | ||||
-rw-r--r-- | test/test-tdarm-simple.cpp (renamed from test/test-tdarm-simple.c) | 8 |
2 files changed, 9 insertions, 7 deletions
diff --git a/test/test-dis.c b/test/test-dis.c index 127b0b4..8b4a2b3 100644 --- a/test/test-dis.c +++ b/test/test-dis.c @@ -1,13 +1,13 @@ #include <stdio.h> #include "dis.h" unsigned f(unsigned x) { - struct bitslice addr = {.nruns = 4, .runs = (struct bitslice_run[]) {{0,0,4}, {5,5,7}, {16,13,4}, {23,12,1}}}; - return bs_get(addr, x); + struct bitslice addr = {.nruns = 4, .runs = {{0,0,4}, {5,5,7}, {16,13,4}, {23,12,1}}}; + return bs_get(&addr, x); } unsigned fs(unsigned val, unsigned op) { - struct bitslice addr = {.nruns = 4, .runs = (struct bitslice_run[]) {{0,0,4}, {5,5,7}, {16,13,4}, {23,12,1}}}; - return bs_set(addr, val, op); + struct bitslice addr = {.nruns = 4, .runs = {{0,0,4}, {5,5,7}, {16,13,4}, {23,12,1}}}; + return bs_set(&addr, val, op); } int main() { diff --git a/test/test-tdarm-simple.c b/test/test-tdarm-simple.cpp index 99a5d4a..d590ba8 100644 --- a/test/test-tdarm-simple.c +++ b/test/test-tdarm-simple.cpp @@ -11,13 +11,15 @@ typedef struct tc { } *tdis_ctx; #define P(x) P_##x +__attribute__((noinline)) static void P_data(struct tc *ctx, struct dis_data_operand *ops, size_t nops) { printf("data: %08x\n", ctx->op); for(size_t i = 0; i < nops; i++) { - unsigned val = bs_get(ops[i].n, ctx->op); + const struct bitslice *n = ops[i].n; + unsigned val = bs_get(n, ctx->op); printf(" {"); - for(int j = 0; j < ops[i].n.nruns; j++) { - struct bitslice_run run = ops[i].n.runs[j]; + for(int j = 0; j < n->nruns; j++) { + struct bitslice_run run = n->runs[j]; printf(" %d:%d:%d", run.inpos, run.outpos, run.len); } printf(" } =>\n"); |