-
Notifications
You must be signed in to change notification settings - Fork 129
/
Copy pathSSE2NEONBinding.cpp
56 lines (40 loc) · 885 Bytes
/
SSE2NEONBinding.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "SSE2NEONBinding.h"
#ifdef WIN32
#include <xmmintrin.h>
#include <emmintrin.h>
#include <malloc.h>
#include <crtdbg.h>
#else
#include <stdlib.h>
#include <stdio.h>
#endif
namespace SSE2NEON
{
#ifdef WIN32
void* platformAlignedAlloc(size_t size)
{
return _aligned_malloc(size, 16);
}
void platformAlignedFree(void* ptr)
{
_aligned_free(ptr);
}
#else
void* platformAlignedAlloc(size_t size)
{
//return ::memalign(16, size);
void *address;
int ret=posix_memalign(&address, 16, size);
if(ret!=0){
fprintf(stderr,"Error at File %s line number %d\n",__FILE__, __LINE__);
exit(EXIT_FAILURE);
}
return address;
}
void platformAlignedFree(void* ptr)
{
//::free(ptr);
free(ptr);
}
#endif
} // end of SSE2NEON namespace