ChangeLog rotatation and copyright year update
[deliverable/binutils-gdb.git] / opcodes / arc-dis.c
index ba674549e00edd7f4a93180f1806bfb4aa5c5670..92f69da76a17f7d81889077734f14e87920fa703 100644 (file)
@@ -1,6 +1,5 @@
 /* Instruction printing code for the ARC.
-   Copyright 1994, 1995, 1997, 1998, 2000, 2001, 2002, 2005, 2007, 2009
-   Free Software Foundation, Inc.
+   Copyright (C) 1994-2015 Free Software Foundation, Inc.
    Contributed by Doug Evans (dje@cygnus.com).
 
    This file is part of libopcodes.
    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
    MA 02110-1301, USA.  */
 
-#include "ansidecl.h"
+#include "sysdep.h"
 #include "libiberty.h"
 #include "dis-asm.h"
 #include "opcode/arc.h"
 #include "elf-bfd.h"
 #include "elf/arc.h"
-#include <string.h>
 #include "opintl.h"
 
 #include <stdarg.h>
@@ -60,15 +58,14 @@ typedef enum
 } a4_decoding_class;
 
 #define BIT(word,n)    ((word) & (1 << n))
-#define BITS(word,s,e)  (((word) << (31 - e)) >> (s + (31 - e)))
+#define BITS(word,s,e)  (((word) >> s) & ((1 << (e + 1 - s)) - 1))
 #define OPCODE(word)   (BITS ((word), 27, 31))
 #define FIELDA(word)   (BITS ((word), 21, 26))
 #define FIELDB(word)   (BITS ((word), 15, 20))
 #define FIELDC(word)   (BITS ((word),  9, 14))
 
-/* FIELD D is signed in all of its uses, so we make sure argument is
-   treated as signed for bit shifting purposes:  */
-#define FIELDD(word)   (BITS (((signed int)word), 0, 8))
+/* FIELD D is signed.  */
+#define FIELDD(word)   ((BITS ((word), 0, 8) ^ 0x100) - 0x100)
 
 #define PUT_NEXT_WORD_IN(a)                                            \
   do                                                                   \
@@ -238,7 +235,6 @@ arc_sprintf (struct arcDisState *state, char *buf, const char *format, ...)
   char *bp;
   const char *p;
   int size, leading_zero, regMap[2];
-  long auxNum;
   va_list ap;
 
   va_start (ap, format);
@@ -246,7 +242,6 @@ arc_sprintf (struct arcDisState *state, char *buf, const char *format, ...)
   bp = buf;
   *bp = 0;
   p = format;
-  auxNum = -1;
   regMap[0] = 0;
   regMap[1] = 0;
 
@@ -430,8 +425,7 @@ write_comments_(struct arcDisState * state,
            strcpy (state->commentBuffer, comment_prefix);
          else
            strcat (state->commentBuffer, ", ");
-         strncat (state->commentBuffer, state->comm[i],
-                  sizeof (state->commentBuffer));
+         strcat (state->commentBuffer, state->comm[i]);
        }
     }
 }
@@ -1170,7 +1164,6 @@ decodeInstr (bfd_vma            address, /* Address of this instruction.  */
   struct arcDisState s;                /* ARC Disassembler state.  */
   void *stream = info->stream;         /* Output stream.  */
   fprintf_ftype func = info->fprintf_func;
-  int bytes;
 
   memset (&s, 0, sizeof(struct arcDisState));
 
@@ -1201,7 +1194,7 @@ decodeInstr (bfd_vma            address, /* Address of this instruction.  */
   s.instName = _instName;
 
   /* Disassemble.  */
-  bytes = dsmOneArcInst (address, & s);
+  dsmOneArcInst (address, & s);
 
   /* Display the disassembly instruction.  */
   (*func) (stream, "%08lx ", s.words[0]);
This page took 0.030623 seconds and 4 git commands to generate.