* ax-general.c (ax_const_l): Select proper opcode for the given
authorJim Blandy <jimb@codesourcery.com>
Sun, 7 Jan 2007 15:35:44 +0000 (15:35 +0000)
committerJim Blandy <jimb@codesourcery.com>
Sun, 7 Jan 2007 15:35:44 +0000 (15:35 +0000)
value.

gdb/ChangeLog
gdb/ax-general.c

index 25dac41..2fa60c1 100644 (file)
@@ -1,3 +1,8 @@
+2007-01-07  Jim Blandy  <jimb@codesourcery.com>
+
+       * ax-general.c (ax_const_l): Select proper opcode for the given
+       value.
+
 2007-01-04  Vladimir Prus  <vladimir@codesourcery.com>
 
        * varobj.c (c_value_of_root): Don't select frame if variable
index c08272a..8c1dfe1 100644 (file)
@@ -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]);