title: bitwise AND doesn't work on MSB
body: <p>I'm implementing a bit vector by packing bits into an array of uints. The <code>getBit(index)</code> function does a <code>(array[cell] &amp; (1 &lt;&lt; bit)) &gt;&gt; bit</code> to get whether a bit has been set or not. This works perfectly well for all bits except the MSB. An example of where it doesn't work is as follows.</p>
  
  <pre><code>array[cell] = 11111001 11100000 00000000 00000000
  (1 &lt;&lt; bit)  = 10000000 00000000 00000000 00000000
  &amp; operation = 01111001 11100000 00000000 00000000
  </code></pre>
  
  <p>I can't figure out why the Bitwise AND operation seems to be operating like an XOR. Either that or the MSB got unset. Can anyone explain whats happening? </p>
  
  <p>Edit: Actual code</p>
  
  <pre><code>var cell:uint = int(index / 32);
  var bit:uint = 32 - (index % 32) - 1;
  return (array[cell] &amp; (1 &lt;&lt; bit)) &gt;&gt; bit;
  </code></pre>
  
  <p>In the instance that doesn't work, <code>index = 0</code></p>