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
11
#include "
phoenix_allocAlignedVector.h
"
12
13
#ifndef __APPLE__
14
# include <malloc.h>
15
#endif
16
17
#ifdef __APPLE__
19
23
void
* 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
35
void
*
phoenix_allocAlignedTab
(
size_t
sizeOfVectorInBytes,
size_t
alignementInBytes){
36
return
memalign(alignementInBytes, sizeOfVectorInBytes);
37
}
38
40
49
void
phoenix_freeAlignedVector
(
void
* ptr){
50
if
(ptr == NULL)
return
;
51
free(ptr);
52
}
53
54
55
56
phoenix_allocAlignedTab
void * phoenix_allocAlignedTab(size_t sizeOfVectorInBytes, size_t alignementInBytes)
Alloc an aligned vector.
Definition
phoenix_allocAlignedVector.cpp:35
phoenix_freeAlignedVector
void phoenix_freeAlignedVector(void *ptr)
Free the aligned vector.
Definition
phoenix_allocAlignedVector.cpp:49
phoenix_allocAlignedVector.h
src
phoenix_allocAlignedVector.cpp
Generated by
1.13.2