>>> Andrew Cooper <andrew.coop...@citrix.com> 08/03/17 6:01 PM >>>
>On 03/08/17 16:51, Jan Beulich wrote:
>>>>> Andrew Cooper <andrew.coop...@citrix.com> 07/27/17 7:48 PM >>>
>>> +#define COPY_LEAF(l, s, data)                                   \
>>> +    ({ int ret; /* Elide leaves which are fully empty. */       \
>>> +        if ( (*(uint64_t *)(&(data)->a) |                       \
>>> +              *(uint64_t *)(&(data)->c)) &&                     \
>> This sort of casting looks rather fragile.
>
>I've already factored it out into:
>
>static bool is_empty_leaf(const struct cpuid_leaf *l)
>{
>/*
>* Logically '!(l->a | l->b | l->c | l->d)' but the compiler needs some
>* help realising that its actually looking for 16 bytes of adjacent
>* zeros, and can be far more efficient than using 32bit operations.
     >*/
>return !(*(uint64_t *)&l->a | *(uint64_t *)&l->c);
>}

Better, but I'd still like to ask for BUILD_BUG_ON()s to be added.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to