arudradey's picture
download
raw
415 Bytes
#include <stdlib.h>
// Musl has an aligned_alloc routine, but that builds on top of standard malloc(). We are using dlmalloc, so
// we can route to its implementation instead.
void * weak aligned_alloc(size_t alignment, size_t size)
{
void *ptr;
if ((alignment % sizeof(void *) != 0) || (size % alignment) != 0)
return 0;
int ret = posix_memalign(&ptr, alignment, size);
return (ret == 0) ? ptr : 0;
}

Xet Storage Details

Size:
415 Bytes
·
Xet hash:
8ab8d4a0b0bd3be92007051356bce5054661e13ac48190aee2e7de14d71bef4a

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.