/* Sign-extend a value which is N bits long. */
#define SEX(value, bits) \
- ((((int)(value)) << ((8 * sizeof (int)) - bits)) \
- >> ((8 * sizeof (int)) - bits) )
+ ((int) (((value & ((1u << (bits - 1) << 1) - 1)) \
+ ^ (1u << (bits - 1))) - (1u << (bits - 1))))
static char *reg_names[] =
{ "g0", "g1", "g2", "g3", "g4", "g5", "g6", "g7",
another, it is important to order the opcodes in the right order. */
for (i = 0; i < 32; ++i)
{
- unsigned long int x = 1 << i;
+ unsigned long int x = 1ul << i;
int x0 = (match0 & x) != 0;
int x1 = (match1 & x) != 0;
for (i = 0; i < 32; ++i)
{
- unsigned long int x = 1 << i;
+ unsigned long int x = 1ul << i;
int x0 = (lose0 & x) != 0;
int x1 = (lose1 & x) != 0;
case 'h':
(*info->fprintf_func) (stream, "%%hi(%#x)",
- ((unsigned) 0xFFFFFFFF
- & ((int) X_IMM22 (insn) << 10)));
+ (unsigned) X_IMM22 (insn) << 10);
break;
case 'i': /* 13 bit immediate. */
&& X_RD (prev_insn) == X_RS1 (insn))
{
(*info->fprintf_func) (stream, "\t! ");
- info->target =
- ((unsigned) 0xFFFFFFFF
- & ((int) X_IMM22 (prev_insn) << 10));
+ info->target = (unsigned) X_IMM22 (prev_insn) << 10;
if (imm_added_to_rs1)
info->target += X_SIMM (insn, 13);
else