\internal Like malloc, but the returned pointer is guaranteed to be 16-byte aligned. * Fast, but wastes 16 additional bytes of memory. Does not throw any exception. */
| 84 | * Fast, but wastes 16 additional bytes of memory. Does not throw any exception. |
| 85 | */ |
| 86 | inline void* handmade_aligned_malloc(std::size_t size) |
| 87 | { |
| 88 | void *original = std::malloc(size+EIGEN_DEFAULT_ALIGN_BYTES); |
| 89 | if (original == 0) return 0; |
| 90 | void *aligned = reinterpret_cast<void*>((reinterpret_cast<std::size_t>(original) & ~(std::size_t(EIGEN_DEFAULT_ALIGN_BYTES-1))) + EIGEN_DEFAULT_ALIGN_BYTES); |
| 91 | *(reinterpret_cast<void**>(aligned) - 1) = original; |
| 92 | return aligned; |
| 93 | } |
| 94 | |
| 95 | /** \internal Frees memory allocated with handmade_aligned_malloc */ |
| 96 | inline void handmade_aligned_free(void *ptr) |
no outgoing calls
no test coverage detected