title: Faster than memcmp
body: <p>I have a UUID class that has an inbuilt 16 byte buffer for the UUID.</p>
  
  <p>The <code>&gt;</code>, <code>&lt;</code>, <code>==</code>, <code>!=</code> overloaded operators just call <code>memcmp()</code> over the 16 byte value.</p>
  
  <p>Since this class is going to be used on a 64-bit architecture only, would it be faster to compare the 128 bits using two 64-bit ints instead?</p>
  
  <p>e.g.
  Instead of:</p>
  
  <pre><code>memcmp(uuid1, uuid2, 16) == 0
  </code></pre>
  
  <p>Can I just do something like:</p>
  
  <pre><code>unsigned long* id1 = (unsigned long*)uuid1;
  unsigned long* id2 = (unsigned long*)uuid2;
  bool equal = (id1[0] == id2[0] &amp;&amp; id1[1] == id2[1]);
  </code></pre>
  
  <p>Or does the <code>memcmp()</code> function used by G++ do this kind of optimisation already?
  On the other hand, not using <code>memcmp()</code> will avoid the function call overhead yes?</p>