[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] add canonical address checks to HVM

>>> Keir Fraser <keir@xxxxxxxxxxxxx> 01.12.06 11:12 >>>
>On 29/11/06 15:05, "Jan Beulich" <jbeulich@xxxxxxxxxx> wrote:
>> +#ifdef __x86_64__
>> +#define IS_CANO_ADDRESS(add) (((long)(add) >> 47) == ((long)(add) >> 63))
>> +#else
>> +#define IS_CANO_ADDRESS(add) 1
>> +#endif
>> +
>Is there any guarantee that right-shift is signed when using gcc?

I suppose so, I believe this is assumed to be that way in various other places.
However, I'm not sure I have an idea where I could look up implementation
defined behavior for gcc.

>How about (int16_t)((add) >> 48) == -(int)(((add) >> 47) & 1) ??

Sure, should work too, but would incur more overhead. I was actually trying
to even avoid the two shifts, but I wasn't able to find something that would
use just one *and* would be faster than the version I submitted.


Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.