diff options
Diffstat (limited to 'include/gmisc')
-rw-r--r-- | include/gmisc/gmisc.h | 17 | ||||
-rw-r--r-- | include/gmisc/options.h | 12 |
2 files changed, 23 insertions, 6 deletions
diff --git a/include/gmisc/gmisc.h b/include/gmisc/gmisc.h index 5943e642..ff3d0c76 100644 --- a/include/gmisc/gmisc.h +++ b/include/gmisc/gmisc.h @@ -184,6 +184,23 @@ extern "C" { /** @} */ #endif +#if GMISC_NEED_INVSQRT + /** + * @brief Fast inverse square root function (x^-1/2) + * @return The approximate inverse square root + * + * @param[in] n The number to find the inverse square root of + * + * @note This function generates an approximate result. Higher accuracy (at the expense + * of speed) can be obtained by modifying the source code (the necessary line + * is already there - just commented out). + * @note This function relies on the internal machine format of a float and a long. + * If your machine architecture is very unusual this function may not work. + * + * @api + */ + float invsqrt(float n); +#endif #ifdef __cplusplus } #endif diff --git a/include/gmisc/options.h b/include/gmisc/options.h index d5cf5898..73b41800 100644 --- a/include/gmisc/options.h +++ b/include/gmisc/options.h @@ -28,18 +28,18 @@ #define GMISC_NEED_ARRAYOPS FALSE
#endif
/**
- * @brief Include fast array based trig functions (sin, cos)
+ * @brief Include fast fixed point trig functions (sin, cos)
* @details Defaults to FALSE
*/
- #ifndef GMISC_NEED_FASTTRIG
- #define GMISC_NEED_FASTTRIG FALSE
+ #ifndef GMISC_NEED_FIXEDTRIG
+ #define GMISC_NEED_FIXEDTRIG FALSE
#endif
/**
- * @brief Include fast fixed point trig functions (sin, cos)
+ * @brief Include fast inverse square root (x^-1/2)
* @details Defaults to FALSE
*/
- #ifndef GMISC_NEED_FIXEDTRIG
- #define GMISC_NEED_FIXEDTRIG FALSE
+ #ifndef GMISC_NEED_INVSQRT
+ #define GMISC_NEED_INVSQRT FALSE
#endif
/**
* @}
|