Clean up the memalign switching a bit

This commit is contained in:
Luke Benstead 2018-10-18 09:54:34 +01:00
parent 78f5fc698a
commit b9f8fe4a4d
2 changed files with 11 additions and 14 deletions

View File

@ -2,16 +2,14 @@
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#ifndef __APPLE__ #if defined(__APPLE__) || defined(__WIN32__)
#if defined(__WIN32__)
/* Linux + Kos define this, OSX does not, so just use malloc there */ /* Linux + Kos define this, OSX does not, so just use malloc there */
#define memalign(x, size) malloc((size)) static inline void* memalign(size_t alignment, size_t size) {
return malloc(size);
}
#else #else
#include <malloc.h> #include <malloc.h>
#endif #endif
/* Linux + Kos define this, OSX does not, so just use malloc there */
#define memalign(x, size) malloc((size))
#endif
#include "aligned_vector.h" #include "aligned_vector.h"

View File

@ -1,15 +1,14 @@
#include <string.h> #include <string.h>
#include <stdlib.h>
#ifndef __APPLE__ #if defined(__APPLE__) || defined(__WIN32__)
#if defined(__WIN32__)
/* Linux + Kos define this, OSX does not, so just use malloc there */ /* Linux + Kos define this, OSX does not, so just use malloc there */
#define memalign(x, size) malloc((size)) static inline void* memalign(size_t alignment, size_t size) {
return malloc(size);
}
#else #else
#include <malloc.h> #include <malloc.h>
#endif #endif
/* Linux + Kos define this, OSX does not, so just use malloc there */
#define memalign(x, size) malloc((size))
#endif
#include "stack.h" #include "stack.h"