I have a problem wherein I need to find the number of matching bits (from left to right) between two integers
Inputs: 2 Variable A and B to store my decimal numbers
Output: Numbers of bits in A and B that match (starting from the left)
Some Examples:
A = 3 and B = 2
, A and B bits match up to 7 bits from the left bit
A = 3 and B = 40
, A and B bits match up to 7 bits from the left bit.
How can I do that using bitwise operation (AND,OR,XOR)?
Thanks