5.2.2 : The source (asterics_alloc.cpp)

The asterics_alloc.cpp is :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef __APPLE__
#	include <malloc.h>
#else
#	include <stdlib.h>
#endif

#include "asterics_alloc.h"

#ifdef __APPLE__
void * memalign(long unsigned int alignementInBytes, long unsigned int sizeOfVectorInBytes){
	void * ptr = NULL;
	posix_memalign(&ptr, alignementInBytes, sizeOfVectorInBytes);
	return ptr;
}
#endif

void * asterics_malloc(long unsigned int sizeOfVectorInBytes){
	return memalign(VECTOR_ALIGNEMENT, sizeOfVectorInBytes);
}

void asterics_free(void* ptr){
	free(ptr);
}