Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r1244 - in trunk/Core: . Math


Chronological Thread 
  • From: sparker@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r1244 - in trunk/Core: . Math
  • Date: Mon, 4 Dec 2006 16:49:39 -0700 (MST)

Author: sparker
Date: Mon Dec  4 16:49:39 2006
New Revision: 1244

Added:
   trunk/Core/Math/SSEDefs.cc
Modified:
   trunk/Core/CMakeLists.txt
   trunk/Core/Math/SSEDefs.h
Log:
Implmented ostream << for __m128 and __m128i


Modified: trunk/Core/CMakeLists.txt
==============================================================================
--- trunk/Core/CMakeLists.txt   (original)
+++ trunk/Core/CMakeLists.txt   Mon Dec  4 16:49:39 2006
@@ -51,6 +51,7 @@
      Math/ipow.h
      Math/CatmullRomInterpolator.h
      Math/SSEDefs.h
+     Math/SSEDefs.cc
      )
 SET (CORE_SOURCES ${CORE_SOURCES}
      Util/Args.h

Added: trunk/Core/Math/SSEDefs.cc
==============================================================================
--- (empty file)
+++ trunk/Core/Math/SSEDefs.cc  Mon Dec  4 16:49:39 2006
@@ -0,0 +1,21 @@
+
+#include <Core/Math/SSEDefs.h>
+#include <iostream>
+
+namespace std {
+  std::ostream& operator<<(std::ostream& os, __m128 t)
+  {
+    MANTA_ALIGN(16) float f[4];
+    _mm_store_ps(f,t);
+    os << f[0] << ", " << f[1] << ", " << f[2] << ", " << f[3];
+    return os;
+  }
+
+  std::ostream& operator<<(std::ostream& os, __m128i t)
+  {
+    MANTA_ALIGN(16) int i[4];
+    _mm_store_si128((__m128i*)&i[0],t);
+    os << i[0] << ", " << i[1] << ", " << i[2] << ", " << i[3];
+    return os;
+  }
+}

Modified: trunk/Core/Math/SSEDefs.h
==============================================================================
--- trunk/Core/Math/SSEDefs.h   (original)
+++ trunk/Core/Math/SSEDefs.h   Mon Dec  4 16:49:39 2006
@@ -52,6 +52,11 @@
 #define cast_f2i _mm_castps_si128
 #define sqrt4 _mm_sqrt_ps
 
+namespace std {
+  std::ostream& operator<<(std::ostream& os, __m128);
+  std::ostream& operator<<(std::ostream& os, __m128i);
+}
+
 namespace Manta
 {
     union sse_union
@@ -312,10 +317,7 @@
     
     inline void simd_cerr(sse_t t)
     {  
-        MANTA_ALIGN(16)
-        float f[4];
-        _mm_store_ps(f,t);
-        std::cerr << f[0] << ", " << f[1] << ", " << f[2] << ", " << f[3] << 
std::endl;
+      std::cerr << t << std::endl;
     }
 
     inline Vec3f as_Vec3f(sse_t t)




  • [MANTA] r1244 - in trunk/Core: . Math, sparker, 12/04/2006

Archive powered by MHonArc 2.6.16.

Top of page