Don't rely on inferior_ptid in record_full_wait
[deliverable/binutils-gdb.git] / opcodes / ns32k-dis.c
index 22a9389ecff2dee701885b045e063c9c5b4fdb2a..51b39260c4f68cb5efb854ce07fe950de521fbc0 100644 (file)
@@ -1,5 +1,5 @@
 /* Print National Semiconductor 32000 instructions.
-   Copyright (C) 1986-2019 Free Software Foundation, Inc.
+   Copyright (C) 1986-2020 Free Software Foundation, Inc.
 
    This file is part of the GNU opcodes library.
 
@@ -262,8 +262,8 @@ list_search (int reg_value, const struct ns32k_option *optionP, char *result)
 static int
 bit_extract (bfd_byte *buffer, int offset, int count)
 {
-  int result;
-  int bit;
+  unsigned int result;
+  unsigned int bit;
 
   if (offset < 0 || count < 0)
     return 0;
@@ -291,8 +291,8 @@ bit_extract (bfd_byte *buffer, int offset, int count)
 static int
 bit_extract_simple (bfd_byte *buffer, int offset, int count)
 {
-  int result;
-  int bit;
+  unsigned int result;
+  unsigned int bit;
 
   if (offset < 0 || count < 0)
     return 0;
@@ -325,12 +325,10 @@ bit_copy (bfd_byte *buffer, int offset, int count, char *to)
 }
 
 static int
-sign_extend (int value, int bits)
+sign_extend (unsigned int value, unsigned int bits)
 {
-  value = value & ((1 << bits) - 1);
-  return (value & (1 << (bits - 1))
-         ? value | (~((1 << bits) - 1))
-         : value);
+  unsigned int sign = 1u << (bits - 1);
+  return ((value & (sign + sign - 1)) ^ sign) - sign;
 }
 
 static void
This page took 0.029126 seconds and 4 git commands to generate.