+2020-01-04 Alan Modra <amodra@gmail.com>
+
+ * d30v-dis.c (print_insn): Avoid signed overflow in left shift.
+
2020-01-03 Jan Beulich <jbeulich@suse.com>
* aarch64-tbl.h (aarch64_opcode_table): Use
/* IMM6S3 is unsigned. */
if (oper->flags & OPERAND_SIGNED || bits == 32)
{
- long max;
- max = (1 << (bits - 1));
- if (val & max)
+ unsigned int sign = 1u << (bits - 1);
+ if (val & sign)
{
- if (bits == 32)
- val = -val;
- else
- val = -val & ((1 << bits) - 1);
+ val = -val & (sign + sign - 1);
neg = 1;
}
}
{
if (oper->flags & OPERAND_SIGNED)
{
- int max = (1 << (bits - 1));
+ unsigned int sign = 1u << (bits - 1);
- if (val & max)
+ if (val & sign)
{
- val = -val;
- if (bits < 32)
- val &= ((1 << bits) - 1);
+ val = -val & (sign + sign - 1);
(*info->fprintf_func) (info->stream, "-");
}
}