/* Functions for manipulating expressions designed to be executed on the agent
- Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2007 Free Software Foundation, Inc.
This file is part of GDB.
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]);