title: Why (int)((unsigned int)((int)v)?
body: <p><a href="https://graphics.stanford.edu/~seander/bithacks.html">The website in which I found this code</a></p>
  
  <pre><code>int v, sign;
  // or, to avoid branching on CPUs with flag registers (IA32):
  sign = -(int)((unsigned int)((int)v) &gt;&gt; (sizeof(int) * CHAR_BIT - 1));  // if v &lt; 0 then -1, else 0. 
  </code></pre>
  
  <p>This statement assigns variable sign with the sign of variable v (either -1 or 0). I wonder why <code>(int)((unsigned int)((int)v)</code> is used instead of a plain v?</p>