aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcomex2015-01-12 00:29:50 -0500
committercomex2015-01-12 00:29:50 -0500
commitcf582afba779e325663a2b24e34f7ec4135adfd9 (patch)
tree8c4d17c2246905e80a7673192a9d11ec862ca702
parentimprove test (diff)
downloadsubstitute-cf582afba779e325663a2b24e34f7ec4135adfd9.tar.gz
minor improvements
-rw-r--r--lib/dis-arm64.inc.h3
-rw-r--r--lib/dis.h9
-rw-r--r--test/test-td-simple.c1
3 files changed, 10 insertions, 3 deletions
diff --git a/lib/dis-arm64.inc.h b/lib/dis-arm64.inc.h
index d99cae7..19f986a 100644
--- a/lib/dis-arm64.inc.h
+++ b/lib/dis-arm64.inc.h
@@ -19,6 +19,9 @@ static INLINE tdis_ret P(am_ldrlit_label_unk_Rt_6_LDRDl)(tdis_ctx ctx, struct bi
static INLINE tdis_ret P(am_tbrcond_target_B_4_TBNZW)(tdis_ctx ctx, struct bitslice target) {
return P(branch)(ctx, ctx->pc + sext(bs_get(target, ctx->op), 14) * 4);
}
+static INLINE tdis_ret P(GPR64_Rn_1_RET)(tdis_ctx ctx, UNUSED struct bitslice Rn) {
+ return P(ret)(ctx);
+}
static tdis_ret P(dis_arm64)(tdis_ctx ctx) {
unsigned op = ctx->op;
diff --git a/lib/dis.h b/lib/dis.h
index 3802421..09220c0 100644
--- a/lib/dis.h
+++ b/lib/dis.h
@@ -67,7 +67,7 @@ static const struct bitslice nullbs = { 0, NULL };
#define rnull nullbs, false, false
#define data(...) data_(__VA_ARGS__, rnull, rnull, rnull, rnull)
#define data_(...) data__(__VA_ARGS__)
-#define data__(b1, o1, v1, b2, o2, v2, b3, o3, v3, b4, o4, v4, ...) \
+#define data__(b1, o1, v1, b2, o2, v2, b3, o3, v3, b4, o4, v4, ...) do { \
tdis_ret ret = P(data)(ctx, \
v1 ? bs_get(b1, ctx->op) : -1u, \
v2 ? bs_get(b2, ctx->op) : -1u, \
@@ -77,7 +77,8 @@ static const struct bitslice nullbs = { 0, NULL };
(o2 << 1) | \
(o3 << 2) | \
(o4 << 3)); \
- if(ret.modify) { \
+ IF_BOTHER_WITH_MODIFY( \
+ if (ret.modify) { \
unsigned new = ctx->op; \
new = bs_set(b1, ctx->newval[0], new); \
new = bs_set(b2, ctx->newval[1], new); \
@@ -85,5 +86,7 @@ static const struct bitslice nullbs = { 0, NULL };
new = bs_set(b4, ctx->newval[3], new); \
ctx->newop = new; \
} \
- return ret;
+ ) \
+ return ret; \
+} while (0)
diff --git a/test/test-td-simple.c b/test/test-td-simple.c
index 00bf179..c69483e 100644
--- a/test/test-td-simple.c
+++ b/test/test-td-simple.c
@@ -1,6 +1,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
+#define IF_BOTHER_WITH_MODIFY(...) __VA_ARGS__
#include "dis.h"
typedef struct { bool modify; } tdis_ret;