Fix compiling on OSX

This commit is contained in:
Luke Benstead 2018-05-25 21:08:39 +01:00
parent b9a2351f0a
commit 2f014f55b6
2 changed files with 16 additions and 2 deletions

View File

@ -2,10 +2,17 @@
#define ALIGNED_VECTOR_H #define ALIGNED_VECTOR_H
#include <stdlib.h> #include <stdlib.h>
#include <malloc.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#ifndef __APPLE__
#include <malloc.h>
#else
/* Linux + Kos define this, OSX does not, so just use malloc there */
#define memalign(x, size) malloc((size))
#endif
#define ALIGNED_VECTOR_INITIAL_CAPACITY 256u #define ALIGNED_VECTOR_INITIAL_CAPACITY 256u
typedef struct { typedef struct {

View File

@ -1,9 +1,16 @@
#ifndef STACK_H #ifndef STACK_H
#define STACK_H #define STACK_H
#include <malloc.h>
#include <string.h> #include <string.h>
#ifndef __APPLE__
#include <malloc.h>
#else
/* Linux + Kos define this, OSX does not, so just use malloc there */
#define memalign(x, size) malloc((size))
#endif
typedef struct { typedef struct {
unsigned char* data; unsigned char* data;
unsigned int capacity; unsigned int capacity;