Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenlib/intern/math_base_inline.c')
-rw-r--r--source/blender/blenlib/intern/math_base_inline.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c
index e6217329145..39116d6f30f 100644
--- a/source/blender/blenlib/intern/math_base_inline.c
+++ b/source/blender/blenlib/intern/math_base_inline.c
@@ -44,6 +44,24 @@
# define UNLIKELY(x) (x)
#endif
+/* powf is really slow for raising to integer powers. */
+MINLINE float pow2f(float x)
+{
+ return x * x;
+}
+MINLINE float pow3f(float x)
+{
+ return pow2f(x) * x;
+}
+MINLINE float pow4f(float x)
+{
+ return pow2f(pow2f(x));
+}
+MINLINE float pow7f(float x)
+{
+ return pow2f(pow3f(x)) * x;
+}
+
MINLINE float sqrt3f(float f)
{
if (UNLIKELY(f == 0.0f)) return 0.0f;