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