Say you have two 30-bit unsigned integers a and b and you want to compute a*2^16/b but the catch is division is only supported on 31-bit integers. What’s the right way to do this? Assume a and b are such that the result fits in 30 bits.
I got stuck without scratch paper but I think you want to do some algebraic manipulations writing things out with remainders and counting bits.
-
-
It wouldn't surprise me. I didn't make a lot of progress on it, but I kept getting tripped up dealing with remainders. I probably should have tried doing something with the division theorem rather than forming fractions.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.