Answers for "how to find greatest using bitwise operator"

0

how to find greatest using bitwise operator

// Function to find the largest number
int findMax(int a, int b)
{
    int z, i, max;
  
    // Perform the subtraction
    z = a - b;
  
    // Right shift and Bitwise AND
    i = (z >> 31) & 1;
  
    // Find the maximum number
    max = a - (i * z);
  
    // Return the maximum value
    return max;
}
Posted by: Guest on June-01-2021

Code answers related to "how to find greatest using bitwise operator"

Browse Popular Code Answers by Language