isPositive - return true if x > 0, otherwise false
isPositive
true
x > 0
false
Example: isPositive(-1)
isPositive(-1)
Legal ops:
Why not use XOR (^)?
XOR (^)
Try this,
{ return ((x>>31)&1)^(!!x); }
It can deal with the 0 case well.