c - How do I programmatically return the max of two integers without using any comparison operators and without using if, else, etc? -
how programmatically return maximum of 2 integers without using comparison operators , without using if
, else
, etc?
max: // put max(a,b) a
a -= b; &= (~a) >> 31; += b;
and:
int a, b;
min: // put min(a,b) a
a -= b; &= >> 31; += b;
from here.
Comments
Post a Comment