aboutsummaryrefslogtreecommitdiffstats
path: root/include/gmisc/gmisc.h
diff options
context:
space:
mode:
authorJoel Bodenmann <joel@unormal.org>2013-11-10 21:07:16 +0100
committerJoel Bodenmann <joel@unormal.org>2013-11-10 21:07:16 +0100
commitda2740b706d720292113445ee1db30f8a9873dc4 (patch)
tree8f8b1902d4af6a23b3daf26990f580b76ea31ea4 /include/gmisc/gmisc.h
parent6ca3537a696e7ace8098771a9a7105380604253d (diff)
parenta8ce005e2621b0108863297948cea0fa52c8bf2a (diff)
downloaduGFX-da2740b706d720292113445ee1db30f8a9873dc4.tar.gz
uGFX-da2740b706d720292113445ee1db30f8a9873dc4.tar.bz2
uGFX-da2740b706d720292113445ee1db30f8a9873dc4.zip
merging GDISPStreaming
Diffstat (limited to 'include/gmisc/gmisc.h')
-rw-r--r--include/gmisc/gmisc.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/gmisc/gmisc.h b/include/gmisc/gmisc.h
index 998dda50..ff3d0c76 100644
--- a/include/gmisc/gmisc.h
+++ b/include/gmisc/gmisc.h
@@ -51,6 +51,7 @@ typedef int32_t fixed;
*/
#define FIXED(x) ((fixed)(x)<<16) /* @< integer to fixed */
#define NONFIXED(x) ((x)>>16) /* @< fixed to integer */
+#define FIXED0_5 32768 /* @< 0.5 as a fixed (used for rounding) */
#define FP2FIXED(x) ((fixed)((x)*65536.0)) /* @< floating point to fixed */
#define FIXED2FP(x) ((double)(x)/65536.0) /* @< fixed to floating point */
/* @} */
@@ -183,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