title: Bit shifts in c++
body: <p>I don't understand why this gives me the same answer:</p>
  
  <pre><code> long long a = 3265917058 &gt;&gt; 24;
   std::cout &lt;&lt; a &lt;&lt; std::endl; //194
  
   long long ip = 3265917058;
   long long b = ip &gt;&gt; 24;
   std::cout &lt;&lt; b &lt;&lt; std::endl; //194
  </code></pre>
  
  <p>but this don't:</p>
  
  <pre><code> long long a = (3265917058 &lt;&lt; 16) &gt;&gt; 24;
   std::cout &lt;&lt; a &lt;&lt; std::endl; //240
  
   long long ip = 3265917058;
   long long b = (ip &lt;&lt; 16) &gt;&gt; 24;
   std::cout &lt;&lt; b &lt;&lt; std::endl; //12757488 - **i want this to be 240 too!**
  </code></pre>
  
  <p>Update: I want 32bit shift , but how can i 32bit shift a number that is too large for an int variable?
  Update2: My answer is to make unsigned int ip. Then everything will be ok.</p>