From 44a8177417b268fdcf9d619ae14af64156b2b5f5 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Sun, 7 Jan 2007 15:35:44 +0000 Subject: [PATCH] * ax-general.c (ax_const_l): Select proper opcode for the given value. --- gdb/ChangeLog | 5 +++++ gdb/ax-general.c | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 25dac419421..2fa60c1597b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2007-01-07 Jim Blandy + + * ax-general.c (ax_const_l): Select proper opcode for the given + value. + 2007-01-04 Vladimir Prus * varobj.c (c_value_of_root): Don't select frame if variable diff --git a/gdb/ax-general.c b/gdb/ax-general.c index c08272a3b7a..8c1dfe1b68a 100644 --- a/gdb/ax-general.c +++ b/gdb/ax-general.c @@ -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]); -- 2.30.2