Alex 2957f5084d
[Library] Update zlibng (#1255)
* Update zlibng

* Set cmake path more directly in zlibng to hopefully fix an issue with the build on drone

* I'm dumb, missing / in path

* Mackal helps with a dumb gitignore issue

* Adding all the files, not sure what's ignoring them and im tired of looking

* Some tweaks to zlibng build to hopefully get it to build properly. works on msvc now
2021-02-23 19:00:26 -06:00

35 lines
677 B
C

/* zutil_p.h -- Private inline functions used internally in zlib-ng
*
*/
#ifndef ZUTIL_P_H
#define ZUTIL_P_H
#ifdef __APPLE__
# include <stdlib.h>
#else
# include <malloc.h>
#endif
/* Function to allocate 16 or 64-byte aligned memory */
static inline void *zng_alloc(size_t size) {
#if defined(_WIN32)
return (void *)_aligned_malloc(size, 64);
#elif defined(__APPLE__)
return (void *)malloc(size); /* MacOS always aligns to 16 bytes */
#else
return (void *)memalign(64, size);
#endif
}
/* Function that can free aligned memory */
static inline void zng_free(void *ptr) {
#if defined(_WIN32)
_aligned_free(ptr);
#else
free(ptr);
#endif
}
#endif