Index: cpu/frv.opc |
diff --git a/cpu/frv.opc b/cpu/frv.opc |
index f81cef0d60860ec62611f2abfa916a7818ab126f..869155d67afc1294f5516fb9d9ff955474c72cc2 100644 |
--- a/cpu/frv.opc |
+++ b/cpu/frv.opc |
@@ -1343,11 +1343,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; |