MCPcopy Create free account
hub / github.com/ErrorAtLine0/infinipaint / aligned_realloc

Function aligned_realloc

include/Eigen/src/Core/util/Memory.h:243–265  ·  view source on GitHub ↗

* \internal * \brief Reallocates an aligned block of memory. * \throws std::bad_alloc on allocation failure */

Source from the content-addressed store, hash-verified

241 * \throws std::bad_alloc on allocation failure
242 */
243EIGEN_DEVICE_FUNC inline void* aligned_realloc(void* ptr, std::size_t new_size, std::size_t old_size) {
244 if (ptr == nullptr) return aligned_malloc(new_size);
245 if (old_size == new_size) return ptr;
246 if (new_size == 0) {
247 aligned_free(ptr);
248 return nullptr;
249 }
250
251 void* result;
252#if (EIGEN_DEFAULT_ALIGN_BYTES == 0) || EIGEN_MALLOC_ALREADY_ALIGNED
253 EIGEN_UNUSED_VARIABLE(old_size)
254
255 check_that_malloc_is_allowed();
256 EIGEN_USING_STD(realloc)
257 result = realloc(ptr, new_size);
258#else
259 result = handmade_aligned_realloc(ptr, new_size, old_size);
260#endif
261
262 if (!result && new_size) throw_std_bad_alloc();
263
264 return result;
265}
266
267/*****************************************************************************
268*** Implementation of conditionally aligned functions ***

Callers 1

Calls 5

aligned_mallocFunction · 0.85
aligned_freeFunction · 0.85
handmade_aligned_reallocFunction · 0.85
throw_std_bad_allocFunction · 0.85

Tested by

no test coverage detected