title: c++ bmp bitwise operator
body: <pre><code> for(unsigned int  h=0; h&lt;ImageBits.iHeight; h++)
    {
          for(unsigned int  w=0; w&lt;ImageBits.iWidth; w++)
          {
                // So in this loop - if our data isn't aligned to 4 bytes, then its been padded
                // in the file so it aligns...so we check for this and skip over the padded 0's
                // Note here, that the data is read in as b,g,r and not rgb as you'd think!
                unsigned char r,g,b;
                fread(&amp;b, 1, 1, fp);
                fread(&amp;g, 1, 1, fp);
                fread(&amp;r, 1, 1, fp);
  
                ImageBits.pARGB[ w + h*ImageBits.iWidth ] = (r&lt;&lt;16 | g&lt;&lt;8 | b);
  
          }// End of for loop w
  
          //If there are any padded bytes - we skip over them here
          if( iNumPaddedBytes != 0 )
          {
                unsigned char skip[4];
                fread(skip, 1, 4 - iNumPaddedBytes, fp);
          }// End of if reading padded bytes
  
    }// End of for loop h
  </code></pre>
  
  <p>I do not understand this statement and how does it store the rgb value of the pixel</p>
  
  <pre><code>ImageBits.pARGB[ w + h*ImageBits.iWidth ] = (r&lt;&lt;16 | g&lt;&lt;8 | b);
  </code></pre>
  
  <p>i did a read up on the &lt;&lt; bitwise shift operator but i still do not understand how it works.Can someone help me out here.</p>