getting certain bits from hex value
<p>Im trying to get bits 6 to 15 of a hex value in c++. Im using &amp; 0xFFC0, and when i print the value of those bits im getting values over 1024. but since its 10 bits the highest value that can be accessed is 1024, correct?</p>

<p>I have a 32 bit address which is 
    tag = 31 to 16
    index = 15 to 6
    offset = 5 to 0</p>

<p>my code looks like this</p>

<pre><code>long long offset = address &amp; 0x1F;
long long index = address &amp;0xFFC0;
long long tag = address &amp; 0xFFFF0000;
</code></pre>