include/common.h
branchpyrit
changeset 91 9d66d323c354
parent 86 ce6abe0aeeae
child 92 9af5c039b678
--- a/include/common.h	Tue Apr 29 23:31:08 2008 +0200
+++ b/include/common.h	Fri May 02 13:27:47 2008 +0200
@@ -33,9 +33,6 @@
 #include <pthread.h>
 #include <string>
 
-// SSE intrinsics
-#include <xmmintrin.h>
-
 using namespace std;
 
 #ifdef PYRIT_DOUBLE
@@ -48,13 +45,27 @@
 # define Inf FLT_MAX
 #endif
 
+#ifndef NO_SSE
+// SSE intrinsics
+#include <xmmintrin.h>
+
 const __m128 mZero = _mm_set_ps1(0.);
 const __m128 mOne = _mm_set_ps1(1.);
+const __m128 mTwo = _mm_set_ps1(2.);
 const __m128 mEps = _mm_set_ps1(Eps);
 const __m128 mMEps = _mm_set_ps1(-Eps);
 const __m128 mInf = _mm_set_ps1(Inf);
 const __m128 mAllSet = _mm_cmplt_ps(mZero, mOne);
 
+inline const __m128 _mm_fastpow(const __m128& base, const __m128& exponent)
+{
+    __m128 denom = _mm_mul_ps( exponent, base);
+    denom = _mm_sub_ps( exponent, denom);
+    denom = _mm_add_ps( base, denom);
+    return _mm_mul_ps( base, _mm_rcp_ps(denom));
+}
+#endif
+
 /* verbosity level:
 0: only errors (E)
 1: major status messages (*)