Austin Schuh | 189376f | 2018-12-20 22:11:15 +1100 | [diff] [blame] | 1 | // This file is part of Eigen, a lightweight C++ template library |
| 2 | // for linear algebra. |
| 3 | // |
| 4 | // This Source Code Form is subject to the terms of the Mozilla |
| 5 | // Public License v. 2.0. If a copy of the MPL was not distributed |
| 6 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. |
Brian Silverman | 72890c2 | 2015-09-19 14:37:37 -0400 | [diff] [blame] | 7 | |
| 8 | #ifndef EIGEN_QTMALLOC_MODULE_H |
| 9 | #define EIGEN_QTMALLOC_MODULE_H |
| 10 | |
| 11 | #include "Core" |
| 12 | |
| 13 | #if (!EIGEN_MALLOC_ALREADY_ALIGNED) |
| 14 | |
| 15 | #include "src/Core/util/DisableStupidWarnings.h" |
| 16 | |
Austin Schuh | 189376f | 2018-12-20 22:11:15 +1100 | [diff] [blame] | 17 | void *qMalloc(std::size_t size) |
Brian Silverman | 72890c2 | 2015-09-19 14:37:37 -0400 | [diff] [blame] | 18 | { |
| 19 | return Eigen::internal::aligned_malloc(size); |
| 20 | } |
| 21 | |
| 22 | void qFree(void *ptr) |
| 23 | { |
| 24 | Eigen::internal::aligned_free(ptr); |
| 25 | } |
| 26 | |
Austin Schuh | 189376f | 2018-12-20 22:11:15 +1100 | [diff] [blame] | 27 | void *qRealloc(void *ptr, std::size_t size) |
Brian Silverman | 72890c2 | 2015-09-19 14:37:37 -0400 | [diff] [blame] | 28 | { |
| 29 | void* newPtr = Eigen::internal::aligned_malloc(size); |
Austin Schuh | 189376f | 2018-12-20 22:11:15 +1100 | [diff] [blame] | 30 | std::memcpy(newPtr, ptr, size); |
Brian Silverman | 72890c2 | 2015-09-19 14:37:37 -0400 | [diff] [blame] | 31 | Eigen::internal::aligned_free(ptr); |
| 32 | return newPtr; |
| 33 | } |
| 34 | |
| 35 | #include "src/Core/util/ReenableStupidWarnings.h" |
| 36 | |
| 37 | #endif |
| 38 | |
| 39 | #endif // EIGEN_QTMALLOC_MODULE_H |
| 40 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ |