Eigen  5.0.1
 
Loading...
Searching...
No Matches
QtAlignedMalloc
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/.
7// SPDX-FileCopyrightText: The Eigen Authors
8// SPDX-License-Identifier: MPL-2.0
9
10#ifndef EIGEN_QTMALLOC_MODULE_H
11#define EIGEN_QTMALLOC_MODULE_H
12
13#include "Core"
14
15#if (!EIGEN_MALLOC_ALREADY_ALIGNED)
16
17#include "src/Core/util/DisableStupidWarnings.h"
18
19inline void *qMalloc(std::size_t size) { return Eigen::internal::aligned_malloc(size); }
20
21inline void qFree(void *ptr) { Eigen::internal::aligned_free(ptr); }
22
23inline void *qRealloc(void *ptr, std::size_t size) {
24 void *newPtr = Eigen::internal::aligned_malloc(size);
25 std::memcpy(newPtr, ptr, size);
26 Eigen::internal::aligned_free(ptr);
27 return newPtr;
28}
29
30#include "src/Core/util/ReenableStupidWarnings.h"
31
32#endif
33
34#endif // EIGEN_QTMALLOC_MODULE_H