added hack to fix an alignment issue in MSVC 2010

The default allocator in Visual Studio 2010 does not respect the
alignment requirements of classes it is allocating memory for. This
results in a potential crash when using OEngine::Physics::PhysicActor
that has been allocated on the heap if it is built against a version of
Bullet that has SSE intrinsics enabled.
This commit is contained in:
Nathan Jeffords 2012-12-30 22:02:55 -08:00
parent 7228f5d696
commit a842fc2c11

View file

@ -122,8 +122,13 @@ namespace Physic
*/
void runPmove();
//HACK: in Visual Studio 2010 and presumably above, this structures alignment
// must be 16, but the built in operator new & delete don't properly
// perform this alignment.
#if _MSC_VER >= 1600
void * operator new (size_t Size) { return _aligned_malloc (Size, 16); }
void operator delete (void * Data) { _aligned_free (Data); }
#endif
private: