PhoenixHardware  0.2.0
Tools to get hardware information
Loading...
Searching...
No Matches
phoenix_allocAlignedVector.cpp
Go to the documentation of this file.
1/***************************************
2 Auteur : Pierre Aubert
3 Mail : pierre.aubert@lapp.in2p3.fr
4 Licence : CeCILL-C
5****************************************/
6
7#include <stdlib.h>
8#include <stdint.h> //pour uintptr_t
9#include <stdio.h>
10
12
13#ifndef __APPLE__
14# include <malloc.h>
15#endif
16
17#ifdef __APPLE__
19
23void * memalign(size_t alignementInBytes,size_t sizeOfVectorInBytes){
24 void * ptr = NULL;
25 posix_memalign(&ptr, alignementInBytes, sizeOfVectorInBytes);
26 return ptr;
27}
28#endif
29
31
35void* phoenix_allocAlignedTab(size_t sizeOfVectorInBytes, size_t alignementInBytes){
36 return memalign(alignementInBytes, sizeOfVectorInBytes);
37}
38
40
50 if(ptr == NULL) return;
51 free(ptr);
52}
53
54
55
56
void * phoenix_allocAlignedTab(size_t sizeOfVectorInBytes, size_t alignementInBytes)
Alloc an aligned vector.
void phoenix_freeAlignedVector(void *ptr)
Free the aligned vector.