given x, y
try x + -y if <0, then y is greater, if> 0, then x is greater.
-y = binary complement to y:
-y = (~(y-1)) <==> -y = (~y)+1
From what I see, you are doing a binary addition with (~ y +1)), which is the same thing.
Then bitdrive β 31 to get MSB and equal to 1.
Be sure to set the brackets, operator priority!
(y+-x) >> (31 & 1); != ((y+-x) >> 31) & 1;
source share