Package of useful macros and functions e.g. for fixedpoint operations.
Math Functions | Package of useful macros and functions e.g. |
Fixedpoint Macros | |
D2_FIX4(x) | Integer to n:4 fixedpoint conversion |
D2_INT4(x) | n:4 to integer conversion |
D2_FLOOR4(x) | n:4 fixedpoint unsigned floor (round towards -inf) |
D2_CEIL4(x) | n:4 fixedpoint unsigned ceil (round towards +inf) |
D2_FRAC4(x) | n:4 fixedpoint fractional part only |
D2_FIX16(x) | integer to n:16 fixedpoint conversion |
D2_INT16(x) | n:16 to integer conversion |
D2_FLOOR16(x) | n:16 fixedpoint unsigned floor (round towards -inf) |
D2_CEIL16(x) | n:16 fixedpoint unsigned ceil (round towards +inf) |
D2_FRAC16(x) | n:16 fixedpoint fractional part only |
D2_EPSILON | Smallest representable positive number (all fixedpoint formats) |
Math Functions | |
d2_sqrt | Minimalistic 32->16 bit integer square root (no hw divide/multiply needed) unrolled for speed. |
d2_pow2mask | Find next larger power of two minus 1 |
Minimalistic 32->16 bit integer square root (no hw divide/multiply needed) unrolled for speed.
D2_EXTERN d2_s32 d2_sqrt( d2_u32 x )
Find next larger power of two minus 1
D2_EXTERN d2_u32 d2_pow2mask( d2_u32 x )