title: shift left bit of -1
body: <p>While solving problems, I stuck here thinking how the output of this program gives <code>ffffffff</code>. Since the left shift of bits should give -2. I cross-checked here <a href="http://calculator.vhex.net/calculator/bit/shift-bits-of-a-number-to-the-left" rel="nofollow noreferrer">Online Calculator</a> giving -2. I can see the binary value of -1 is 11111111. But how?
  Also, my observance from here <a href="http://www.binaryconvert.com/result_signed_short.html?decimal=045049" rel="nofollow noreferrer">Signed int conversion</a>:</p>
  <blockquote>
  <p>-1 ---&gt; 0xff --&gt; 1111 1111</p>
  <p>-2 ---&gt; 0xfe --&gt; 1111 1110</p>
  <p>-3 ---&gt; 0xfd --&gt; 1111 1101</p>
  <p>-8 ---&gt; 0xf8 --&gt; 1111 1000</p>
  </blockquote>
  <pre><code>#include&lt;stdio.h&gt;
  int main()
  {
     printf(&quot;%x&quot;, -1&lt;&lt;1);
     getchar();
     return 0;
  }  
  </code></pre>
  <p>Please tell me how the compiler looks integers below 0 when bitwise shift operators are used?</p>