#63441 - LOst? - Tue Dec 13, 2005 4:57 am
Okay, last time I wanted help, it was all about fixed point math and divide. People helped me to see how to construct fixed point fractions.
Now I have run into another problem. I need to construct bitshifts to replace multiplication.
Here are two examples...
Using slow multiplication:
And using bitshifts and additions instead:
Using slow multiplication:
And using bitshifts and additions instead:
Now, is there any technique I should use to come up with these bitwise/addition formulas?
I want to be able to do this in bitwise/addition formula:
How do I do? How must I think?
_________________
Exceptions are fun
Now I have run into another problem. I need to construct bitshifts to replace multiplication.
Here are two examples...
Using slow multiplication:
Code: |
1 * 12 = 12 4 * 12 = 48 |
And using bitshifts and additions instead:
Code: |
((1 << 2) + ((1 << 2) << 1)) = 12 ((4 << 2) + ((4 << 2) << 1)) = 48 |
Using slow multiplication:
Code: |
1 * 1152 = 1152 4 * 1152 = 4608 |
And using bitshifts and additions instead:
Code: |
((1 << 7) + ((1 << 7) << 3)) = 1152 ((4 << 7) + ((4 << 7) << 3)) = 4608 |
Now, is there any technique I should use to come up with these bitwise/addition formulas?
I want to be able to do this in bitwise/addition formula:
Code: |
1 * 14 = 14 4 * 14 = 56 |
How do I do? How must I think?
_________________
Exceptions are fun