Compute the integer absolute value (abs) without branching - GeeksforGeeks
Hi, I have found another method to calculate the absolute value, though I have not been able to find some mathematical derivation for that. The method calculates absolute value as: abs(x) = x – (2*x & mask); where mask= x >> 31; The following is a C progr...