fix CS_INSN_OFFSET: calculate offset based on the address of related instruction only

This commit is contained in:
Nguyen Anh Quynh 2013-12-05 20:21:09 +08:00
parent a84d747f7c
commit a236902656
1 changed files with 2 additions and 1 deletions

View File

@ -96,7 +96,8 @@ typedef struct cs_insn {
// Calculate the offset of a disassembled instruction in its buffer, given its position
// in its array of disassembled insn
#define CS_INSN_OFFSET(insns, p) (insns[p-1].address - insns[0].address + insns[p-1].size)
// NOTE: this macro works with position (>=1), not index
#define CS_INSN_OFFSET(insns, post) (insns[post - 1].address - insns[0].address)
// All type of errors encountered by Capstone API.