2009-01-20 16:50:47 +00:00
|
|
|
#ifndef EIGEN_QTMALLOC_MODULE_H
|
|
|
|
|
#define EIGEN_QTMALLOC_MODULE_H
|
|
|
|
|
|
2009-10-22 20:06:05 +02:00
|
|
|
#if (!EIGEN_MALLOC_ALREADY_ALIGNED)
|
|
|
|
|
|
2009-10-22 09:29:59 +02:00
|
|
|
#ifdef QVECTOR_H
|
|
|
|
|
#error You must include <Eigen/QtAlignedMalloc> before <QtCore/QVector>.
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef Q_DECL_IMPORT
|
|
|
|
|
#define Q_DECL_IMPORT_ORIG Q_DECL_IMPORT
|
|
|
|
|
#undef Q_DECL_IMPORT
|
|
|
|
|
#define Q_DECL_IMPORT
|
|
|
|
|
#else
|
|
|
|
|
#define Q_DECL_IMPORT
|
|
|
|
|
#endif
|
|
|
|
|
|
2009-01-20 16:50:47 +00:00
|
|
|
#include "Core"
|
2009-10-22 09:29:59 +02:00
|
|
|
|
|
|
|
|
#include <QtCore/QVector>
|
2009-01-20 16:50:47 +00:00
|
|
|
|
2009-01-26 13:59:52 +00:00
|
|
|
inline void *qMalloc(size_t size)
|
2009-01-20 16:50:47 +00:00
|
|
|
{
|
|
|
|
|
return Eigen::ei_aligned_malloc(size);
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-26 13:59:52 +00:00
|
|
|
inline void qFree(void *ptr)
|
2009-01-20 16:50:47 +00:00
|
|
|
{
|
|
|
|
|
Eigen::ei_aligned_free(ptr);
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-26 13:59:52 +00:00
|
|
|
inline void *qRealloc(void *ptr, size_t size)
|
2009-01-20 16:50:47 +00:00
|
|
|
{
|
|
|
|
|
void* newPtr = Eigen::ei_aligned_malloc(size);
|
|
|
|
|
memcpy(newPtr, ptr, size);
|
|
|
|
|
Eigen::ei_aligned_free(ptr);
|
|
|
|
|
return newPtr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
2009-10-22 09:29:59 +02:00
|
|
|
#ifdef Q_DECL_IMPORT_ORIG
|
|
|
|
|
#define Q_DECL_IMPORT Q_DECL_IMPORT_ORIG
|
|
|
|
|
#undef Q_DECL_IMPORT_ORIG
|
|
|
|
|
#else
|
|
|
|
|
#undef Q_DECL_IMPORT
|
|
|
|
|
#endif
|
|
|
|
|
|
2009-01-20 16:50:47 +00:00
|
|
|
#endif // EIGEN_QTMALLOC_MODULE_H
|