This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: Question: Checking register value in buffer
On Thu, May 19, 2005 at 12:48:57PM +1000, Joel Brobecker wrote:
> In terms of computing the mask, I'm thinking of using something
> like this:
>
> sign_mask = 1 << (sizeof (rav) * TARGET_CHAR_BIT - 1);
This confuses host and target notions. You would have wanted
the *host* CHAR_BIT, since you're using the host sizeof.
> zero_mask = sign_mask ^ -1;
This fails if rav is *wider* than 64-bits.
> Are there better ways of computing these masks?
How about just
sign = (LONGEST)1 << 63
zero = sign - 1;
r~