title: Does bit-shift depend on endianness?
body: <p>Suppose I have the number <code>'numb'=1025 [00000000 00000000 00000100 00000001]</code> represented:</p>
  
  <p>On Little-Endian Machine:</p>
  
  <pre><code>00000001 00000100 00000000 00000000
  </code></pre>
  
  <p>On Big-Endian Machine:</p>
  
  <pre><code>00000000 00000000 00000100 00000001
  </code></pre>
  
  <p>Now, if I apply Left Shift on 10 bits (i.e.: numb &lt;&lt;= 10), I should have:</p>
  
  <p>[A] On Little-Endian Machine:</p>
  
  <p>As I noticed in GDB, Little Endian does the Left Shift in 3 steps: [I have shown '3' Steps to better understand the processing only]</p>
  
  <ol>
  <li><p>Treat the no. in Big-Endian Convention:</p>
  
  <pre><code>00000000        00000000        00000100    00000001
  </code></pre></li>
  <li><p>Apply Left-Shift:</p>
  
  <pre><code>00000000        00010000        00000100        00000000
  </code></pre></li>
  <li><p>Represent the Result again in Little-Endian:</p>
  
  <pre><code>00000000        00000100        00010000        00000000 
  </code></pre></li>
  </ol>
  
  <p>[B]. On Big-Endian Machine:</p>
  
  <pre><code>00000000        00010000        00000100        00000000
  </code></pre>
  
  <hr>
  
  <p>My Question is:</p>
  
  <p>If I directly apply a Left Shift on the Little Endian 
  Convention, it should give:</p>
  
  <p><code>numb</code>:</p>
  
  <pre><code>00000001 00000100 00000000 00000000
  </code></pre>
  
  <p><code>numb &lt;&lt; 10</code>:</p>
  
  <pre><code>00010000 00000000 00000000 00000000
  </code></pre>
  
  <p>But actually, it gives:</p>
  
  <pre><code>00000000        00000100        00010000        00000000 
  </code></pre>
  
  <p>To achieve the second result only, I have shown three hypothetical steps above.</p>
  
  <p>Please explain me why the above two results are different: The actual outcome of <code>numb &lt;&lt; 10</code> is different than the expected outcome.</p>