39 auto space = bytes + alignment;
40 void *buffer = malloc(space +
sizeof(
void *));
46 void *alignBase = (
void **)buffer + 1;
51 void *ret = osvr::align(alignment, bytes, alignBase, space);
53 if (space < bytes || !ret) {
59 ((
void **)ret)[-1] = buffer;
67 free(((
void **)p)[-1]);
void * osvrAlignedAlloc(size_t bytes, size_t alignment)
Aligned allocation function, gives a pointer to a block of memory aligned to a memory boundary...
void osvrAlignedFree(void *p)
Aligned deallocation function, uses the pointer to the original memory block to deallocate it...
Header wrapping std::align or a backported version - whichever we have is imported into the osvr name...