QtAlignedMalloc 900 B

123456789101112131415161718192021222324252627282930313233343536373839
  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. #ifndef EIGEN_QTMALLOC_MODULE_H
  8. #define EIGEN_QTMALLOC_MODULE_H
  9. #include "Core"
  10. #if (!EIGEN_MALLOC_ALREADY_ALIGNED)
  11. #include "src/Core/util/DisableStupidWarnings.h"
  12. void *qMalloc(std::size_t size)
  13. {
  14. return Eigen::internal::aligned_malloc(size);
  15. }
  16. void qFree(void *ptr)
  17. {
  18. Eigen::internal::aligned_free(ptr);
  19. }
  20. void *qRealloc(void *ptr, std::size_t size)
  21. {
  22. void* newPtr = Eigen::internal::aligned_malloc(size);
  23. std::memcpy(newPtr, ptr, size);
  24. Eigen::internal::aligned_free(ptr);
  25. return newPtr;
  26. }
  27. #include "src/Core/util/ReenableStupidWarnings.h"
  28. #endif
  29. #endif // EIGEN_QTMALLOC_MODULE_H