aboutsummaryrefslogtreecommitdiffstats
path: root/src/Interleaver.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2019-05-06 15:04:16 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2019-05-06 15:04:16 +0200
commit8cb5b3eac1bb669b8828777489d54e9d9057fe6f (patch)
tree50d578356013903c516cc03bdaa514168e2a4695 /src/Interleaver.cpp
parentb74b895dd44f5a76d581b8dec65dbf76dd5cece9 (diff)
downloaddabmux-8cb5b3eac1bb669b8828777489d54e9d9057fe6f.tar.gz
dabmux-8cb5b3eac1bb669b8828777489d54e9d9057fe6f.tar.bz2
dabmux-8cb5b3eac1bb669b8828777489d54e9d9057fe6f.zip
Stop using variable length array in Interleaver
Diffstat (limited to 'src/Interleaver.cpp')
-rw-r--r--src/Interleaver.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/Interleaver.cpp b/src/Interleaver.cpp
index 7d69810..cf0d235 100644
--- a/src/Interleaver.cpp
+++ b/src/Interleaver.cpp
@@ -28,23 +28,17 @@
#endif // _WIN32
-Interleaver::Interleaver(unsigned short I, unsigned short M, bool reverse)
+Interleaver::Interleaver(unsigned short I, unsigned short M, bool reverse) :
+ I(I),
+ M(M),
+ N(I * M),
+ memSize((this->N * I) - 1)
{
- this->I = I;
- this->M = M;
- this->N = I * M;
- this->memSize = (this->N * I) - 1;
- this->mem = new char[memSize];
+ mem.resize(memSize);
setReverse(reverse);
}
-Interleaver::~Interleaver()
-{
- delete []mem;
-}
-
-
void Interleaver::setReverse(bool state)
{
reverse = state;
@@ -56,7 +50,7 @@ void Interleaver::reset()
{
j = 0;
index = 0;
- bzero(mem, memSize);
+ memset(mem.data(), 0, memSize * sizeof(mem[0]));
}