Force memory aligment to 32 bytes

This commit is contained in:
ismagom 2016-01-11 11:43:39 +01:00
parent 23e3f94f73
commit 8924c9d477
1 changed files with 5 additions and 9 deletions

View File

@ -309,22 +309,18 @@ void srslte_vec_deinterleave_real_cf(cf_t *x, float *real, uint32_t len) {
#endif
}
/* Note: We align memory to 32 bytes (for AVX compatibility)
* because in some cases volk can incorrectly detect the architecture.
* This could be inefficient for SSE or non-SIMD platforms but shouldn't
* be a huge problem.
*/
void *srslte_vec_malloc(uint32_t size) {
#ifndef HAVE_VOLK
void *ptr;
if (posix_memalign(&ptr,32,size)) {
return NULL;
} else {
return ptr;
}
#else
void *ptr;
if (posix_memalign(&ptr,volk_get_alignment(),size)) {
return NULL;
} else {
return ptr;
}
#endif
}
void *srslte_vec_realloc(void *ptr, uint32_t old_size, uint32_t new_size) {