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

Michael S. Tsirkin mst at mellanox.co.il
Thu Jun 23 09:45:55 PDT 2005


Quoting r. Roland Dreier <roland at topspin.com>:
> It's odd that you saw the expession end up as 0.  It seems that on every
> system I have, 1ull << 64 is 0, and 0 - 1 == -1 == 0xffffffffffffffff.
> So although it isn't correct C, it should work.

It seems that compiler generates a single instruction for this shift.

And CPU designers apparently have cut a corner by simply using only low 6 bits
in the operand of a shift, so that 1ull<<64 is same as 1ull<<(64&0x37), or 1.

-- 
MST



More information about the general mailing list