Question: Checking register value in buffer

Richard Henderson rth@redhat.com
Thu May 19 03:23:00 GMT 2005


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~



More information about the Gdb-patches mailing list