How to convert UUID to big endian?
<p><strong>My UUID is structured like this:</strong></p>

<pre><code>struct UUID_FIELDS
{
    uint32_t time_low;                
    uint16_t time_mid;                 
    uint16_t time_hi_and_version;      
    uint8_t clock_seq_hi_and_reserved;
    uint8_t clock_seq_low;             
    uint8_t node[6];                   

};
</code></pre>

<p>I have functions that <code>swap</code> along 32 bit boundaries and a <code>swap function</code> that swaps along 16 bit boundaries. I have tried calling <code>swap32()</code> on <code>time_low</code> and <code>swap16()</code> on <code>time_mid</code> and <code>time_hi_and_version</code>. I do not believe I need to swap bytes for the rest of the fields because two of them are 8 bit fields and I have read that the node part of a uuid does not change. <a href="http://howtowriteaprogram.blogspot.com/2009/03/uuid-and-byte-order.html" rel="nofollow">Here is a link for that reference.</a></p>

<p>The problem is when I complete the swaps the uuid that is printed does not match the one that was in little endian before being converted.</p>

<p>What is the correct way to convert a uuid following <strong>RFC-4122 standard</strong> from <code>little endian</code> to <code>big endian</code>. And when converted should the uuids match?</p>