title: Is checking the boolean state of NOT XOR the same as checking equivalence?
body: <p>I was reading through some C code written online and came across the following line:</p>
  
  <pre><code>if(!(array[index] ^ array[index - 1]))
  </code></pre>
  
  <p>The ^ operator is a bitwise XOR, so I read this line to say that it will return true if "The array value at index is <em>not</em> different to the value at the previous index." Simplified, I read this as "If the array value at the index is the same as the one at the previous index."</p>
  
  <p>When I read it like that, it seems like an overcomplicated way to write:</p>
  
  <pre><code>if(array[index] == array[index - 1])
  </code></pre>
  
  <p><strong>Are these expressions the same? If not, then why?</strong> If I'm not misreading it, the best explanation I have is that since this code is involved with interrupts on clock signals it needs to be quick. Maybe a bitwise operation is faster than whatever goes on behind-the-scenes with <code>==</code>?</p>