SSE With Swig
Andrew Wilkinson
ajw126NO at SPAMyork.ac.uk
Sat Jun 29 16:18:08 EDT 2002
Hi,
I'm trying to develop a Vector class that uses Intel's SSE extension. It
works very well when called using c or c++, but when I wrap the class with
Swig I get a privileged instruction exception error (this is under Windows
2000 using MSVC++ 6sp5 with the processor pack installed).
I've included the code below, any suggestions would be greatly appreciated
Andrew Wilkinson
swig.i
%module Vector
%{
#include "Vector.h"
%}
class Vector
{
public:
Vector();
virtual ~Vector();
Vector* operator+(const Vector *other);
float x;
float y;
float z;
float w;
};
__
vector.h
class Vector
{
public:
Vector();
virtual ~Vector();
Vector* operator+(const Vector *other);
__declspec(align(16)) union {
__m128 v;
struct {
float x;
float y;
float z;
float w;
};
};
};
---
vector.cpp
#include "Vector.h"
#include <xmmintrin.h>
Vector::Vector()
{
x = 0.0f; y = 0.0f; z = 0.0f; w = 0.0f;
}
Vector::~Vector()
{
}
Vector* Vector::operator +(const Vector *other)
{
Vector* r = new Vector;
r->v = _mm_add_ps(v, (other->v)); // The exception occurs here.
return r;
}
--
---
Ditch The Decimal System!
Lets Use Hex - http://www.intuitor.com/hex/switch.html
More information about the Python-list
mailing list