diff options
author | Jim Blandy <jimb@codesourcery.com> | 2007-01-07 15:35:44 +0000 |
---|---|---|
committer | Jim Blandy <jimb@codesourcery.com> | 2007-01-07 15:35:44 +0000 |
commit | 44a8177417b268fdcf9d619ae14af64156b2b5f5 (patch) | |
tree | 18a6a4a7faab5f8db50637e71ac1e2f1bbf77310 /gdb/ax-general.c | |
parent | *** empty log message *** (diff) | |
download | binutils-gdb-44a8177417b268fdcf9d619ae14af64156b2b5f5.tar.gz binutils-gdb-44a8177417b268fdcf9d619ae14af64156b2b5f5.tar.bz2 binutils-gdb-44a8177417b268fdcf9d619ae14af64156b2b5f5.zip |
* ax-general.c (ax_const_l): Select proper opcode for the given
value.
Diffstat (limited to 'gdb/ax-general.c')
-rw-r--r-- | gdb/ax-general.c | 8 |
1 files changed, 6 insertions, 2 deletions
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]); |