#define NP_MAXREADY (((unsigned)(~0)<<1)>>1)
I take it as: fill register sized unsigned int with ones, then shake off MSB, obtaining maximum value for signed int. Is it correct? Also, the reason why they are doing it such way completely evades me, please enlighten.
You may rewrite this as
then you’d notice that the inner shift operation is completely useless, since its only effect is to shift out the highest order bit
which in turn is nothing than
Other than stated in another answer, this is not
INT_MAX, since first of all this one here is anunsigned, so the type is different. Then the representation ofsignedversusunsignedmay have padding bits, so you never can be sure that these two have the same value.