#if X86_TARGET_64BIT
/*
* address of the next instruction.
- * The opcode has already been emmitted,
- * so this is the size of an 32bit displacement +
+ * The opcode has already been emitted,
+ * so this is the size of a 32-bit displacement +
* the size of any immediate value that is part of the instruction (offset),
*/
- uintptr dst = (uintptr)get_target() + 4 + offset;
- intptr disp = dst - addr;
- int ok = disp >= -0x80000000LL && disp <= 0x7fffffffLL;
- /* fprintf(stderr, "x86_RIP_addressing_possible: %llx - %llx %16llx = %d\n", (unsigned long long)dst, (unsigned long long)addr, (long long)disp, ok); */
- return ok;
+ uintptr next = (uintptr)get_target() + 4 + offset;
+ if (addr >= next) {
+ return addr - next <= 0x7fffffffULL;
+ }
+ return next - addr <= 0x80000000ULL;
#else
UNUSED(addr);
UNUSED(offset);
static inline int x86_DISP32_addressing_possible(uintptr addr)
{
#if X86_TARGET_64BIT
- return addr <= 0xFFFFFFFFULL;
+ return addr <= 0x7FFFFFFFULL;
#else
UNUSED(addr);
return 1;