title: Union and bit masking, how does this work?
body: <p>here is some C code:</p>
  
  <pre><code>float phaseFrac(unsigned int inPhase)
  {
      union { unsigned int itemp; float ftemp; } u;
      u.itemp = 0x3F800000 | (0x007FFF80 &amp; ((inPhase)&lt;&lt;7));
      return u.ftemp - 1.f;
  }
  </code></pre>
  
  <p>I can't wrap my head around the use of "union" here. Am I right in thinking that since both uint and float are 32 bits, the resulting bit pattern in union is reinterpreted as a float value? Or is there some other magic here?</p>
  
  <p>Thanks...</p>