Convert a uint32_t to an int32_t without either a risk of overflow or excessive complexity
<p>How can I best convert a <code>uint32_t</code> to an <code>int32_t</code> quickly with wrapping, in C++?</p>

<p>Some tries:</p>

<pre><code>uint32_t y = UINT32_MAX;
int32_t x = (int32_t)y; // UB on overflow
int32_t x = *(int32_t*)&amp;y; // does this violate strict aliasing?
</code></pre>