title: How can I create a 48-bit uint for bit mask
body: <p>I am trying to create a 48-bit integer value. I understand it may be possible to use a char array or struct, but I want to be able to do bit masking/manipulation and I'm not sure how that can be done.</p>
  
  <p>Currently the program uses a 16-bit uint and I need to change it to 48. It is a bytecode interpreter and I want to expand the memory addressing to 4GB. I could just use 64-bit, but that would waste a lot of space.</p>
  
  <p>Here is a sample of the code:</p>
  
  <pre><code>unsigned int program[] = { 0x1064, 0x11C8, 0x2201, 0x0000 };
  
  void decode( )
  {
    instrNum = (program[i] &amp; 0xF000) &gt;&gt; 12; //the instruction
    reg1     = (program[i] &amp; 0xF00 ) &gt;&gt;  8; //registers
    reg2     = (program[i] &amp; 0xF0  ) &gt;&gt;  4;
    reg3     = (program[i] &amp; 0xF   );
    imm      = (program[i] &amp; 0xFF  ); //pointer to data
  }
  </code></pre>
  
  <p>full program: <a href="http://en.wikibooks.org/wiki/Creating_a_Virtual_Machine/Register_VM_in_C" rel="nofollow">http://en.wikibooks.org/wiki/Creating_a_Virtual_Machine/Register_VM_in_C</a></p>