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

Re: [Xen-devel] [PATCH] vtpmmgr: fix 32-bit compilation



>>> On 25.04.14 at 17:07, <dgdegra@xxxxxxxxxxxxx> wrote:
> On 04/25/2014 03:13 AM, Jan Beulich wrote:
>>>>> On 24.04.14 at 22:39, <dgdegra@xxxxxxxxxxxxx> wrote:
>>> @@ -487,8 +502,8 @@ static void tm_dhkx_gen(void* dhkx1, void* dhkx2, void* 
>>> out)
>>>     };
>>>
>>>     do_random(Xp, sizeof(Xp));
>>> -   while (Xp[31] == 0 || Xp[31] == -1UL)
>>> -           do_random(Xp + 31, sizeof(Xp[31]));
>>> +   while (Xp[XpElts - 1] == 0 || Xp[XpElts - 1] == -1UL)
>>
>> Wouldn't that better be ~(t_uint)0, or - without any cast -
>> !(Xp[XpElts - 1] + 1)?
> 
> True, but both of those were longer and (at least imo) no more clear.

The problem with your variant is that is typeof(Xp[0]) is e.g. unsigned
int, the comparison (on a system with long wider than int) will never be
true.

Jan


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


 


Rackspace

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