#28367 - sgeos - Sat Oct 30, 2004 6:26 am
Is there any reason not to use something like this for constants?
-Brendan
Code: |
typedef unsigned long u32;
typedef u32 FIXED; /*** TOFIXED(a,b) * * a = floating point value * b = fixed point fractional component */ #define TOFIXED(a,b) ( (FIXED) (((float)a) * (1 << (b))) ) const FIXED table[] = {TOFIXED(1.5, 8), ...}; x *= TOFIXED(4/3, SOME_RESOLUTION); x /= ... |
-Brendan