2015-10-26 18:46:05 +08:00
|
|
|
// This file is part of Eigen, a lightweight C++ template library
|
|
|
|
// for linear algebra.
|
|
|
|
//
|
|
|
|
// This Source Code Form is subject to the terms of the Mozilla
|
|
|
|
// Public License v. 2.0. If a copy of the MPL was not distributed
|
|
|
|
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2009-01-21 00:50:47 +08:00
|
|
|
|
|
|
|
#ifndef EIGEN_QTMALLOC_MODULE_H
|
|
|
|
#define EIGEN_QTMALLOC_MODULE_H
|
|
|
|
|
|
|
|
#include "Core"
|
|
|
|
|
|
|
|
#if (!EIGEN_MALLOC_ALREADY_ALIGNED)
|
|
|
|
|
2011-02-22 22:31:22 +08:00
|
|
|
#include "src/Core/util/DisableStupidWarnings.h"
|
2009-09-03 03:23:09 +08:00
|
|
|
|
2017-01-24 05:02:53 +08:00
|
|
|
void *qMalloc(std::size_t size)
|
2009-09-03 03:23:09 +08:00
|
|
|
{
|
2010-10-25 22:15:22 +08:00
|
|
|
return Eigen::internal::aligned_malloc(size);
|
2009-01-21 00:50:47 +08:00
|
|
|
}
|
|
|
|
|
2009-05-19 00:09:21 +08:00
|
|
|
void qFree(void *ptr)
|
2009-01-21 00:50:47 +08:00
|
|
|
{
|
2010-10-25 22:15:22 +08:00
|
|
|
Eigen::internal::aligned_free(ptr);
|
2009-01-21 00:50:47 +08:00
|
|
|
}
|
|
|
|
|
2017-01-24 05:02:53 +08:00
|
|
|
void *qRealloc(void *ptr, std::size_t size)
|
2009-01-21 00:50:47 +08:00
|
|
|
{
|
2010-10-25 22:15:22 +08:00
|
|
|
void* newPtr = Eigen::internal::aligned_malloc(size);
|
2017-09-22 15:23:24 +08:00
|
|
|
std::memcpy(newPtr, ptr, size);
|
2010-10-25 22:15:22 +08:00
|
|
|
Eigen::internal::aligned_free(ptr);
|
2009-01-21 00:50:47 +08:00
|
|
|
return newPtr;
|
|
|
|
}
|
|
|
|
|
2011-02-22 22:31:22 +08:00
|
|
|
#include "src/Core/util/ReenableStupidWarnings.h"
|
2009-09-03 03:23:09 +08:00
|
|
|
|
2009-01-21 00:50:47 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // EIGEN_QTMALLOC_MODULE_H
|