disas/arm: avoid clang shifting negative signed warning
authorStefan Hajnoczi <stefanha@redhat.com>
Tue, 10 Nov 2015 15:57:35 +0000 (15:57 +0000)
committerStefan Hajnoczi <stefanha@redhat.com>
Tue, 17 Nov 2015 10:35:56 +0000 (18:35 +0800)
clang 3.7.0 on x86_64 warns about the following:

  disas/arm.c:1782:17: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
    imm |= (-1 << 7);
            ~~ ^

Note that this patch preserves the tab indent in this source file
because the surrounding code still uses tabs.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
disas/arm.c

index 61652465396d308d165249ed8f71b2dd5802b76d..7a7354b76a35956accff18dff9e01d8f742f3802 100644 (file)
@@ -1779,7 +1779,7 @@ print_insn_coprocessor (bfd_vma pc, struct disassemble_info *info, long given,
 
                        /* Is ``imm'' a negative number?  */
                        if (imm & 0x40)
-                         imm |= (-1 << 7);
+                         imm |= (~0u << 7);
 
                        func (stream, "%d", imm);
                      }