title: Conditional Using Bitwise Operators
body: <p>How is the conditional operator represented using bitwise operators?</p>
  
  <p>It is a homework question where I have to implement the conditional operator using only bitwise operations.  It would be simple if <code>if</code> statements were allowed, however it has to be strictly bitwise operators.</p>
  
  <p>Only the operators <code>!</code>, <code>~</code>, <code>&amp;</code>, <code>^</code>, <code>|</code>, <code>+</code>, <code>&gt;&gt;</code>, and <code>&lt;&lt;</code> can be used. No <code>if</code> statements or loops can be used.</p>
  
  <p>The function takes three ints and works just like the normal conditional operator.  The first argument is evaluated as either zero or non-zero. If the first argument is zero then the second argument is returned. If the first argument is non-zero then the third argument is returned.</p>
  
  <p>I was hoping there would be a simple algorithm for this.  Any ideas on where to start would be a great help.</p>