title: Divide two integers using only bitwise operations
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/5284898/implement-division-with-bit-wise-operator">implement division with bit wise operator</a>  </p>
  </blockquote>
  
  
  
  <p>I recently got into more depth by bitwise functions, and started to implement basic arithmetic functions with bitwise operators. So far I have gotten <code>(+, -, *)</code>. However I'm not really sure how to approach division. I know that I could somehow use multiplication instead, but not sure how to approach this using that method either.</p>
  
  <p>So how would I implement division using only bitwise operators these: <code>(|, &amp;, ~, ^, &gt;&gt;, &lt;&lt;)</code> in C? For anyone who asks, this is not homework, just personal knowledge.</p>
  
  <p>If you like, you can call the following functions in the code to make it easier (These are prewritten)</p>
  
  <pre><code>int badd(int n1, int n2);
  int bsub(int n1, int n2);
  int bmult(int n1, int n2);
  </code></pre>