*** empty log message ***
[deliverable/binutils-gdb.git] / gdb / ax-general.c
index 52fcfc844652d26f0c6bbb446edb352696f01f56..e31e850fb4c4184892ecbfad77ab184083fc31f9 100644 (file)
@@ -1,5 +1,5 @@
 /* Functions for manipulating expressions designed to be executed on the agent
-   Copyright 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000, 2007 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -15,8 +15,8 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street, Fifth Floor,
+   Boston, MA 02110-1301, USA.  */
 
 /* Despite what the above comment says about this file being part of
    GDB, we would like to keep these functions free of GDB
@@ -231,8 +231,12 @@ ax_const_l (struct agent_expr *x, LONGEST l)
      signed or unsigned; we always reproduce the value exactly, and
      use the shortest representation.  */
   for (op = 0, size = 8; size < 64; size *= 2, op++)
-    if (-((LONGEST) 1 << size) <= l && l < ((LONGEST) 1 << size))
-      break;
+    {
+      LONGEST lim = 1 << (size - 1);
+
+      if (-lim <= l && l <= lim - 1)
+        break;
+    }
 
   /* Emit the right opcode... */
   ax_simple (x, ops[op]);
This page took 0.023645 seconds and 4 git commands to generate.