aboutsummaryrefslogtreecommitdiffstats
path: root/src/FrequencyInterleaver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/FrequencyInterleaver.cpp')
-rw-r--r--src/FrequencyInterleaver.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/FrequencyInterleaver.cpp b/src/FrequencyInterleaver.cpp
index 29d54bb..e76d525 100644
--- a/src/FrequencyInterleaver.cpp
+++ b/src/FrequencyInterleaver.cpp
@@ -24,7 +24,8 @@
#include <stdio.h>
#include <stdexcept>
-#include <malloc.h>
+#include <string>
+#include <stdlib.h>
#include <complex>
typedef std::complex<float> complexf;
@@ -68,7 +69,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);