[openib-general] Re: [PATCH] Fix ib_pack/unpack for 64 bits

Hal Rosenstock halr at voltaire.com
Thu Jun 23 12:14:34 PDT 2005


On Thu, 2005-06-23 at 12:41, Roland Dreier wrote: 
>     Roland> It's odd that you saw the expession end up as 0.  It seems
>     Roland> that on every system I have, 1ull << 64 is 0, and 0 - 1 ==
>     Roland> -1 == 0xffffffffffffffff.  So although it isn't correct C,
>     Roland> it should work.
> 
> Oh, I see.  A constant left shift of 64 is evaluated to 0 at compile
> time.  But a variable left shift that ends up as 64 indeed gives the
> wrong answer.  So you're right, packer will get the wrong answer.
> 
> I think this should fix it properly:

It does. Thanks.

-- Hal




More information about the general mailing list