I need to divide two numbers by the same value (all fixed-point). It is obvious that doing the inversion first and then applying it twice is faster than two division. So this is my current code (BITS=8)
- Code: Select all
1
2
3I64 rev = ((I64)1<<(BITS+32))/h;
x = (I32)((hx*rev)>>32);
y = (I32)((hy*rev)>>32);3 lines; 0 keywds; 4 nums; 34 ops; 0 strs; 0 coms Syntactic Coloring v0.4 - Dan East
Yet, i'd need to speed this up more since this routine is called quite often in my code.
Does anybody know a fast (accuracy is important) inversion routine (1/value)?
thx,
Daniel
