temp = extension >> operand->shift;
temp &= ((1 << (32 - operand->bits)) - 1);
value |= temp;
+ value = ((value ^ (((unsigned long)1) << 31))
+ - (((unsigned long)1) << 31));
}
else if ((operand->flags & MN10300_OPERAND_24BIT) != 0)
{
temp &= ((1 << (24 - operand->bits)) - 1);
value |= temp;
if ((operand->flags & MN10300_OPERAND_SIGNED) != 0)
- value = ((value & 0xffffff) ^ (~0x7fffff)) + 0x800000;
+ value = ((value & 0xffffff) ^ 0x800000) - 0x800000;
}
else if ((operand->flags & MN10300_OPERAND_EXTENDED) != 0)
{
}
if ((operand->flags & MN10300_OPERAND_SIGNED) != 0
- /* These are properly extended by the code above. */
- && ((operand->flags & MN10300_OPERAND_24BIT) == 0)
- )
- value = ((long)(value << (32 - operand->bits))
- >> (32 - operand->bits));
+ /* These are properly extended by the code above. */
+ && ((operand->flags & MN10300_OPERAND_24BIT) == 0))
+ value = ((value ^ (((unsigned long)1) << (operand->bits - 1)))
+ - (((unsigned long)1) << (operand->bits - 1)));
if (!nocomma
&& (!paren
{
value = ((insn >> (operand->shift + extra_shift))
& ((1 << operand->bits) - 1));
- (*info->fprintf_func) (info->stream, "d%d", value);
+ (*info->fprintf_func) (info->stream, "d%d", (int)value);
}
else if ((operand->flags & MN10300_OPERAND_AREG) != 0)
{
value = ((insn >> (operand->shift + extra_shift))
& ((1 << operand->bits) - 1));
- (*info->fprintf_func) (info->stream, "a%d", value);
+ (*info->fprintf_func) (info->stream, "a%d", (int)value);
}
else if ((operand->flags & MN10300_OPERAND_SP) != 0)
value = ((insn >> (operand->shift + extra_shift))
& ((1 << operand->bits) - 1));
if (value < 8)
- (*info->fprintf_func) (info->stream, "r%d", value);
+ (*info->fprintf_func) (info->stream, "r%d", (int)value);
else if (value < 12)
- (*info->fprintf_func) (info->stream, "a%d", value - 8);
+ (*info->fprintf_func) (info->stream, "a%d", (int)value - 8);
else
- (*info->fprintf_func) (info->stream, "d%d", value - 12);
+ (*info->fprintf_func) (info->stream, "d%d", (int)value - 12);
}
else if ((operand->flags & MN10300_OPERAND_XRREG) != 0)
if (value == 0)
(*info->fprintf_func) (info->stream, "sp", value);
else
- (*info->fprintf_func) (info->stream, "xr%d", value);
+ (*info->fprintf_func) (info->stream, "xr%d", (int)value);
}
else if ((operand->flags & MN10300_OPERAND_USP) != 0)
}
else
- (*info->fprintf_func) (info->stream, "%d", value);
+ (*info->fprintf_func) (info->stream, "%ld", (long)value);
}
/* All done. */
break;