typedefstruct Dav1dMemPool {
pthread_mutex_t lock;
Dav1dMemPoolBuffer *buf; int ref_cnt; int end; #if TRACK_HEAP_ALLOCATIONS enum AllocationType type; #endif
} Dav1dMemPool;
// TODO: Move this to a common location? #define ROUND_UP(x,a) (((x)+((a)-1)) & ~((a)-1))
/* * Allocate align-byte aligned memory. The return value can be released * by calling the dav1d_free_aligned() function.
*/ staticinlinevoid *dav1d_alloc_aligned_internal(const size_t sz, const size_t align) {
assert(!(align & (align - 1))); #ifdef _WIN32 return _aligned_malloc(sz, align); #elif HAVE_POSIX_MEMALIGN void *ptr; if (posix_memalign(&ptr, align, sz)) return NULL; return ptr; #elif HAVE_MEMALIGN return memalign(align, sz); #elif HAVE_ALIGNED_ALLOC // The C11 standard specifies that the size parameter // must be an integral multiple of alignment. return aligned_alloc(align, ROUND_UP(sz, align)); #else #error No aligned allocation functions are available #endif
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.