Index: opcodes/frv-asm.c |
diff --git a/opcodes/frv-asm.c b/opcodes/frv-asm.c |
index dffa059ec2940fe13e32260e65e3bde89967dcb9..3da82616219b7965b4ec5719595ee18bbb6f1bf7 100644 |
--- a/opcodes/frv-asm.c |
+++ b/opcodes/frv-asm.c |
@@ -465,11 +465,11 @@ parse_uhi16 (CGEN_CPU_DESC cd, |
if (errmsg == NULL |
&& result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER) |
{ |
- /* If bfd_vma is wider than 32 bits, but we have a sign- |
- or zero-extension, truncate it. */ |
- if (value >= - ((bfd_vma)1 << 31) |
- || value <= ((bfd_vma)1 << 31) - (bfd_vma)1) |
- value &= (((bfd_vma)1 << 16) << 16) - 1; |
+ /* If value is wider than 32 bits then be |
+ careful about how we extract bits 16-31. */ |
+ if (sizeof (value) > 4) |
+ value &= (((bfd_vma)1 << 16) << 16) - 1; |
+ |
value >>= 16; |
} |
*valuep = value; |