Jump to content
  • Advertisement
Sign in to follow this  
jeff8j

Bitwise division

This topic is 2808 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have been trying to do this for a hobby project of mine for weeks now and for the life of me i cannot figure it out. Im am trying to implement division for my 32 bit integers but the processor that im using does not have division (long story) and I need division im at a stand still and cannot figure any of this out its driving me insane. I need to do simple integer division using only bit shifts can someone help me out with this. Thank you

oh and im using c++ but any pseudo code or code snipnet would help

Share this post


Link to post
Share on other sites
Advertisement
When you mean only bit shifts, does that mean you can't use addition/subtraction?

A quick search brings up many many articles with division algorithms, or is yours a special case somehow?

http://www.bearcave.com/software/divide.htm

Share this post


Link to post
Share on other sites
wow that was fast! I have addition and substraction and i implemented multiplication using bit shifts. I had that page up at one point in time but lost it and havent found an equivalent since (i think i have just been starring at all this way to much lol). Thank you for the link im going to try to implement that into my code.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!