This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: select proper trace agent opcode for constants


Committed.

gdb/ChangeLog:
2007-01-07  Jim Blandy  <jimb@codesourcery.com>

	* ax-general.c (ax_const_l): Select proper opcode for the given
	value.

Index: gdb/ax-general.c
===================================================================
RCS file: /cvs/src/src/gdb/ax-general.c,v
retrieving revision 1.10
diff -u -r1.10 ax-general.c
--- gdb/ax-general.c	17 Dec 2005 22:33:59 -0000	1.10
+++ gdb/ax-general.c	7 Jan 2007 15:34:34 -0000
@@ -231,8 +231,12 @@
      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]);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]