How do I programmatically return the maximum of two integers without using any comparison operators and without using if, else, etc?
if
else
return (a > b ? a : b);
or
int max(int a, int b) { int x = (a - b) >> 31; int y = ~x; return (y & a) | (x & b); }