summaryrefslogtreecommitdiffstats
path: root/src/FrequencyInterleaver.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2017-12-11 15:07:18 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2017-12-11 15:07:18 +0100
commit1087a7f4ad8bb1bc9bf4472bf2734b0e4929e7d1 (patch)
tree639e403dfe0bce5c2714274d19f540223e072def /src/FrequencyInterleaver.cpp
parent1ed50fe16d749ac3a841650c4054d137b9cf7a10 (diff)
downloaddabmod-1087a7f4ad8bb1bc9bf4472bf2734b0e4929e7d1.tar.gz
dabmod-1087a7f4ad8bb1bc9bf4472bf2734b0e4929e7d1.tar.bz2
dabmod-1087a7f4ad8bb1bc9bf4472bf2734b0e4929e7d1.zip
Remove references to malloc.h and use posix_memalign
Diffstat (limited to 'src/FrequencyInterleaver.cpp')
-rw-r--r--src/FrequencyInterleaver.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/FrequencyInterleaver.cpp b/src/FrequencyInterleaver.cpp
index 29d54bb..bd5042c 100644
--- a/src/FrequencyInterleaver.cpp
+++ b/src/FrequencyInterleaver.cpp
@@ -24,7 +24,7 @@
#include <stdio.h>
#include <stdexcept>
-#include <malloc.h>
+#include <stdlib.h>
#include <complex>
typedef std::complex<float> complexf;
@@ -68,7 +68,11 @@ FrequencyInterleaver::FrequencyInterleaver(size_t mode) :
break;
}
- d_indexes = (size_t*)memalign(16, d_carriers * sizeof(size_t));
+ const int ret = posix_memalign((void**)(&d_indexes), 16, d_carriers * sizeof(size_t));
+ if (ret != 0) {
+ throw std::runtime_error("memory allocation failed: " + std::to_string(ret));
+ }
+
size_t* index = d_indexes;
size_t perm = 0;
PDEBUG("i: %4u, R: %4u\n", 0, 0);