Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] r2018 - trunk/Core/Math


Chronological Thread 
  • From: boulos@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [Manta] r2018 - trunk/Core/Math
  • Date: Tue, 29 Jan 2008 10:37:17 -0700 (MST)

Author: boulos
Date: Tue Jan 29 10:37:16 2008
New Revision: 2018

Modified:
   trunk/Core/Math/ipow.h
Log:
Core/Math/ipow.h

 Adding an SSE ipow for constant power and SSE input.


Modified: trunk/Core/Math/ipow.h
==============================================================================
--- trunk/Core/Math/ipow.h      (original)
+++ trunk/Core/Math/ipow.h      Tue Jan 29 10:37:16 2008
@@ -2,6 +2,9 @@
 #ifndef Manta_Core_ipow_h
 #define Manta_Core_ipow_h
 
+#include <MantaSSE.h>
+#include <Core/Math/SSEDefs.h>
+
 namespace Manta {
   inline double ipow(double x, int p)
   {
@@ -26,6 +29,20 @@
     }
     return result;
   }
+
+#ifdef MANTA_SSE
+  inline __m128 ipow(__m128 x, int p) {
+    __m128 result = _mm_set1_ps(1.f);
+    while (p) {
+      if (p&1)
+        result = _mm_mul_ps(result, x);
+      x = _mm_mul_ps(x, x);
+      p >>= 1;
+    }
+    return result;
+  }
+#endif
+
 }
 
 #endif




  • [Manta] r2018 - trunk/Core/Math, boulos, 01/29/2008

Archive powered by MHonArc 2.6.16.

Top of page