Merge branch 'next2' into next
diff --git a/arch/AArch64/AArch64AddressingModes.h b/arch/AArch64/AArch64AddressingModes.h
index 974e746..8378902 100644
--- a/arch/AArch64/AArch64AddressingModes.h
+++ b/arch/AArch64/AArch64AddressingModes.h
@@ -213,16 +213,13 @@
static inline uint64_t AArch64_AM_decodeAdvSIMDModImmType10(uint8_t Imm)
{
- uint64_t EncVal = 0;
- if (Imm & 0x80) EncVal |= 0xff00000000000000ULL;
- if (Imm & 0x40) EncVal |= 0x00ff000000000000ULL;
- if (Imm & 0x20) EncVal |= 0x0000ff0000000000ULL;
- if (Imm & 0x10) EncVal |= 0x000000ff00000000ULL;
- if (Imm & 0x08) EncVal |= 0x00000000ff000000ULL;
- if (Imm & 0x04) EncVal |= 0x0000000000ff0000ULL;
- if (Imm & 0x02) EncVal |= 0x000000000000ff00ULL;
- if (Imm & 0x01) EncVal |= 0x00000000000000ffULL;
- return EncVal;
+ static const uint32_t lookup[16] = {
+ 0x00000000, 0x000000ff, 0x0000ff00, 0x0000ffff,
+ 0x00ff0000, 0x00ff00ff, 0x00ffff00, 0x00ffffff,
+ 0xff000000, 0xff0000ff, 0xff00ff00, 0xff00ffff,
+ 0xffff0000, 0xffff00ff, 0xffffff00, 0xffffffff
+ };
+ return lookup[Imm & 0x0f] | ((uint64_t)lookup[Imm >> 4] << 32);
}
#endif
diff --git a/arch/X86/X86DisassemblerDecoder.c b/arch/X86/X86DisassemblerDecoder.c
index 5e87391..a74357f 100644
--- a/arch/X86/X86DisassemblerDecoder.c
+++ b/arch/X86/X86DisassemblerDecoder.c
@@ -2388,3 +2388,4 @@
}
#endif
+
diff --git a/tests/test_basic.c b/tests/test_basic.c
index 83ebbde..92d84d6 100644
--- a/tests/test_basic.c
+++ b/tests/test_basic.c
@@ -346,25 +346,5 @@
{
test();
-#if 0
-#define offsetof(st, m) __builtin_offsetof(st, m)
-
- cs_insn insn;
- printf("size: %lu\n", sizeof(insn));
- printf("@id: %lu\n", offsetof(cs_insn, id));
- printf("@address: %lu\n", offsetof(cs_insn, address));
- printf("@size: %lu\n", offsetof(cs_insn, size));
- printf("@bytes: %lu\n", offsetof(cs_insn, bytes));
- printf("@mnemonic: %lu\n", offsetof(cs_insn, mnemonic));
- printf("@op_str: %lu\n", offsetof(cs_insn, op_str));
- printf("@regs_read: %lu\n", offsetof(cs_insn, regs_read));
- printf("@regs_read_count: %lu\n", offsetof(cs_insn, regs_read_count));
- printf("@regs_write: %lu\n", offsetof(cs_insn, regs_write));
- printf("@regs_write_count: %lu\n", offsetof(cs_insn, regs_write_count));
- printf("@groups: %lu\n", offsetof(cs_insn, groups));
- printf("@groups_count: %lu\n", offsetof(cs_insn, groups_count));
- printf("@arch: %lu\n", offsetof(cs_insn, x86));
-#endif
-
return 0;
}