title: Using bitwise operators, find a logical not equivalent
body: <p>Using <em>only</em>:</p>
  
  <pre><code>&lt;&lt; &gt;&gt; | ^ &amp; +
  </code></pre>
  
  <p>How can I make a function that is equivalent to the logical not operator (<code>!</code>)?</p>
  
  <p>Right now I have:</p>
  
  <pre><code>int i = (~x + 1) &gt;&gt; 31; 
  int j = (x + 1) &gt;&gt; 31; 
  i = i | j; 
  i = i &amp; 1; 
  return i ^ 1;
  </code></pre>
  
  <p>It works for everything, but <code>-1</code>.</p>