From 8924c9d477fc57b4c6a42e8a42a8d41d2497db55 Mon Sep 17 00:00:00 2001 From: ismagom Date: Mon, 11 Jan 2016 11:43:39 +0100 Subject: [PATCH] Force memory aligment to 32 bytes --- srslte/lib/utils/src/vector.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/srslte/lib/utils/src/vector.c b/srslte/lib/utils/src/vector.c index 2071d5265..79bd48c13 100644 --- a/srslte/lib/utils/src/vector.c +++ b/srslte/lib/utils/src/vector.c @@ -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) {