From 3a4981046c3662a0605ded7ef1802548dff545da Mon Sep 17 00:00:00 2001 From: f4exb Date: Tue, 16 Jul 2024 23:15:13 +0200 Subject: [PATCH] WDSP: remove wcomplex --- wdsp/RXA.cpp | 6 +++--- wdsp/TXA.cpp | 6 +++--- wdsp/amd.cpp | 2 +- wdsp/ammod.cpp | 2 +- wdsp/amsq.cpp | 8 ++++---- wdsp/anb.cpp | 4 ++-- wdsp/anf.cpp | 2 +- wdsp/anr.cpp | 2 +- wdsp/bandpass.cpp | 2 +- wdsp/bps.cpp | 12 ++++++------ wdsp/bpsnba.cpp | 4 ++-- wdsp/cblock.cpp | 2 +- wdsp/cfcomp.cpp | 2 +- wdsp/cfir.cpp | 2 +- wdsp/comm.hpp | 6 ------ wdsp/compress.cpp | 2 +- wdsp/delay.cpp | 4 ++-- wdsp/emph.cpp | 10 +++++----- wdsp/eq.cpp | 10 +++++----- wdsp/fir.cpp | 18 +++++++++--------- wdsp/fircore.cpp | 20 ++++++++++---------- wdsp/firmin.cpp | 4 ++-- wdsp/firopt.cpp | 14 +++++++------- wdsp/fmd.cpp | 4 ++-- wdsp/fmmod.cpp | 2 +- wdsp/fmsq.cpp | 2 +- wdsp/gain.cpp | 2 +- wdsp/gen.cpp | 4 ++-- wdsp/icfir.cpp | 2 +- wdsp/iir.cpp | 26 +++++++++++++------------- wdsp/iqc.cpp | 2 +- wdsp/nbp.cpp | 2 +- wdsp/nob.cpp | 10 +++++----- wdsp/osctrl.cpp | 6 +++--- wdsp/resample.cpp | 2 +- wdsp/rmatch.cpp | 16 ++++++++-------- wdsp/shift.cpp | 2 +- wdsp/siphon.cpp | 18 +++++++++--------- wdsp/slew.cpp | 2 +- wdsp/snba.cpp | 6 +++--- wdsp/ssql.cpp | 4 ++-- wdsp/varsamp.cpp | 4 ++-- wdsp/wcpAGC.cpp | 2 +- 43 files changed, 128 insertions(+), 134 deletions(-) diff --git a/wdsp/RXA.cpp b/wdsp/RXA.cpp index dbe97dc18..54773fa64 100644 --- a/wdsp/RXA.cpp +++ b/wdsp/RXA.cpp @@ -611,9 +611,9 @@ void RXA::destroy_rxa (RXA *rxa) void RXA::flush_rxa (RXA *rxa) { - memset (rxa->inbuff, 0, 1 * rxa->dsp_insize * sizeof (wcomplex)); - memset (rxa->outbuff, 0, 1 * rxa->dsp_outsize * sizeof (wcomplex)); - memset (rxa->midbuff, 0, 2 * rxa->dsp_size * sizeof (wcomplex)); + std::fill(rxa->inbuff, rxa->inbuff + 1 * rxa->dsp_insize * 2, 0); + std::fill(rxa->outbuff, rxa->outbuff + 1 * rxa->dsp_outsize * 2, 0); + std::fill(rxa->midbuff, rxa->midbuff + 2 * rxa->dsp_size * 2, 0); SHIFT::flush_shift (rxa->shift.p); RESAMPLE::flush_resample (rxa->rsmpin.p); GEN::flush_gen (rxa->gen0.p); diff --git a/wdsp/TXA.cpp b/wdsp/TXA.cpp index e8aeca73b..5331cd35e 100644 --- a/wdsp/TXA.cpp +++ b/wdsp/TXA.cpp @@ -558,9 +558,9 @@ void TXA::destroy_txa (TXA *txa) void TXA::flush_txa (TXA* txa) { - memset (txa->inbuff, 0, 1 * txa->dsp_insize * sizeof (wcomplex)); - memset (txa->outbuff, 0, 1 * txa->dsp_outsize * sizeof (wcomplex)); - memset (txa->midbuff, 0, 2 * txa->dsp_size * sizeof (wcomplex)); + std::fill(txa->inbuff, txa->inbuff + 1 * txa->dsp_insize * 2, 0); + std::fill(txa->outbuff, txa->outbuff + 1 * txa->dsp_outsize * 2, 0); + std::fill(txa->midbuff, txa->midbuff + 2 * txa->dsp_size * 2, 0); RESAMPLE::flush_resample (txa->rsmpin.p); GEN::flush_gen (txa->gen0.p); PANEL::flush_panel (txa->panel.p); diff --git a/wdsp/amd.cpp b/wdsp/amd.cpp index f38e221e0..a5acbc4f8 100644 --- a/wdsp/amd.cpp +++ b/wdsp/amd.cpp @@ -247,7 +247,7 @@ void AMD::xamd (AMD *a) } else if (a->in_buff != a->out_buff) { - memcpy (a->out_buff, a->in_buff, a->buff_size * sizeof(wcomplex)); + std::copy (a->in_buff, a->in_buff + a->buff_size * 2, a->out_buff); } } diff --git a/wdsp/ammod.cpp b/wdsp/ammod.cpp index bc4c1d7fe..236c240c9 100644 --- a/wdsp/ammod.cpp +++ b/wdsp/ammod.cpp @@ -82,7 +82,7 @@ void AMMOD::xammod(AMMOD *a) } } else if (a->in != a->out) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } void AMMOD::setBuffers_ammod(AMMOD *a, float* in, float* out) diff --git a/wdsp/amsq.cpp b/wdsp/amsq.cpp index efd136ba0..86b89284d 100644 --- a/wdsp/amsq.cpp +++ b/wdsp/amsq.cpp @@ -55,7 +55,7 @@ void AMSQ::compute_slews(AMSQ *a) void AMSQ::calc_amsq(AMSQ *a) { // signal averaging - a->trigsig = new float[a->size * 2]; // (float *)malloc0(a->size * sizeof(wcomplex)); + a->trigsig = new float[a->size * 2]; a->avm = exp(-1.0 / (a->rate * a->avtau)); a->onem_avm = 1.0 - a->avm; a->avsig = 0.0; @@ -120,7 +120,7 @@ void AMSQ::destroy_amsq (AMSQ *a) void AMSQ::flush_amsq (AMSQ*a) { - memset (a->trigsig, 0, a->size * sizeof (wcomplex)); + std::fill(a->trigsig, a->trigsig + a->size * 2, 0); a->avsig = 0.0; a->state = 0; } @@ -192,12 +192,12 @@ void AMSQ::xamsq (AMSQ *a) } } else if (a->in != a->out) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } void AMSQ::xamsqcap (AMSQ *a) { - memcpy (a->trigsig, a->trigger, a->size * sizeof (wcomplex)); + std::copy(a->trigger, a->trigger + a->size * 2, a->trigsig); } void AMSQ::setBuffers_amsq (AMSQ *a, float* in, float* out, float* trigger) diff --git a/wdsp/anb.cpp b/wdsp/anb.cpp index 5d70be11e..53189228d 100644 --- a/wdsp/anb.cpp +++ b/wdsp/anb.cpp @@ -53,7 +53,7 @@ void ANB::initBlanker(ANB *a) a->ombackmult = 1.0 - a->backmult; for (i = 0; i <= a->trans_count; i++) a->wave[i] = 0.5 * cos(i * a->coef); - memset(a->dline, 0, a->dline_size * sizeof(wcomplex)); + std::fill(a->dline, a->dline + a->dline_size * 2, 0); } ANB* ANB::create_anb ( @@ -178,7 +178,7 @@ void ANB::xanb (ANB *a) } } else if (a->in != a->out) - memcpy (a->out, a->in, a->buffsize * sizeof (wcomplex)); + std::copy(a->in, a->in + a->buffsize * 2, a->out); } void ANB::setBuffers_anb (ANB *a, float* in, float* out) diff --git a/wdsp/anf.cpp b/wdsp/anf.cpp index 9a67a5b0f..4f8e10588 100644 --- a/wdsp/anf.cpp +++ b/wdsp/anf.cpp @@ -139,7 +139,7 @@ void ANF::xanf(ANF *a, int position) } } else if (a->in_buff != a->out_buff) - memcpy (a->out_buff, a->in_buff, a->buff_size * sizeof (wcomplex)); + std::copy(a->in_buff, a->in_buff + a->buff_size * 2, a->out_buff); } void ANF::flush_anf (ANF *a) diff --git a/wdsp/anr.cpp b/wdsp/anr.cpp index 8673ccb2c..7aaabff67 100644 --- a/wdsp/anr.cpp +++ b/wdsp/anr.cpp @@ -140,7 +140,7 @@ void ANR::xanr (ANR *a, int position) } } else if (a->in_buff != a->out_buff) - memcpy (a->out_buff, a->in_buff, a->buff_size * sizeof (wcomplex)); + std::copy(a->in_buff, a->in_buff + a->buff_size * 2, a->out_buff); } void ANR::flush_anr (ANR *a) diff --git a/wdsp/bandpass.cpp b/wdsp/bandpass.cpp index 57ad3a07e..2d5ff8f59 100644 --- a/wdsp/bandpass.cpp +++ b/wdsp/bandpass.cpp @@ -99,7 +99,7 @@ void BANDPASS::xbandpass (BANDPASS *a, int pos) if (a->run && a->position == pos) FIRCORE::xfircore (a->p); else if (a->out != a->in) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } void BANDPASS::setBuffers_bandpass (BANDPASS *a, float* in, float* out) diff --git a/wdsp/bps.cpp b/wdsp/bps.cpp index be4a5f6af..6d2741a9b 100644 --- a/wdsp/bps.cpp +++ b/wdsp/bps.cpp @@ -43,8 +43,8 @@ namespace WDSP { void BPS::calc_bps (BPS *a) { float* impulse; - a->infilt = new float[2 * a->size * 2]; // (float *)malloc0(2 * a->size * sizeof(wcomplex)); - a->product = new float[2 * a->size * 2]; // (float *)malloc0(2 * a->size * sizeof(wcomplex)); + a->infilt = new float[2 * a->size * 2]; + a->product = new float[2 * a->size * 2]; impulse = FIR::fir_bandpass(a->size + 1, a->f_low, a->f_high, a->samplerate, a->wintype, 1, 1.0 / (float)(2 * a->size)); a->mults = FIR::fftcv_mults(2 * a->size, impulse); a->CFor = fftwf_plan_dft_1d(2 * a->size, (fftwf_complex *)a->infilt, (fftwf_complex *)a->product, FFTW_FORWARD, FFTW_PATIENT); @@ -87,7 +87,7 @@ void BPS::destroy_bps (BPS *a) void BPS::flush_bps (BPS *a) { - memset (a->infilt, 0, 2 * a->size * sizeof (wcomplex)); + std::fill(a->infilt, a->infilt + 2 * a->size * 2, 0); } void BPS::xbps (BPS *a, int pos) @@ -96,7 +96,7 @@ void BPS::xbps (BPS *a, int pos) float I, Q; if (a->run && pos == a->position) { - memcpy (&(a->infilt[2 * a->size]), a->in, a->size * sizeof (wcomplex)); + std::copy(a->in, a->in + a->size * 2, &(a->infilt[2 * a->size])); fftwf_execute (a->CFor); for (i = 0; i < 2 * a->size; i++) { @@ -106,10 +106,10 @@ void BPS::xbps (BPS *a, int pos) a->product[2 * i + 1] = I * a->mults[2 * i + 1] + Q * a->mults[2 * i + 0]; } fftwf_execute (a->CRev); - memcpy (a->infilt, &(a->infilt[2 * a->size]), a->size * sizeof(wcomplex)); + std::copy(&(a->infilt[2 * a->size]), &(a->infilt[2 * a->size]) + a->size * 2, a->infilt); } else if (a->in != a->out) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } void BPS::setBuffers_bps (BPS *a, float* in, float* out) diff --git a/wdsp/bpsnba.cpp b/wdsp/bpsnba.cpp index ff1cada46..84817d6f7 100644 --- a/wdsp/bpsnba.cpp +++ b/wdsp/bpsnba.cpp @@ -131,7 +131,7 @@ void BPSNBA::destroy_bpsnba (BPSNBA *a) void BPSNBA::flush_bpsnba (BPSNBA *a) { - memset (a->buff, 0, a->size * sizeof (wcomplex)); + std::fill(a->buff, a->buff + a->size * 2, 0); NBP::flush_nbp (a->bpsnba); } @@ -160,7 +160,7 @@ void BPSNBA::setSize_bpsnba (BPSNBA *a, int size) void BPSNBA::xbpsnbain (BPSNBA *a, int position) { if (a->run && a->position == position) - memcpy (a->buff, a->in, a->size * sizeof (wcomplex)); + std::copy(a->in, a->in + a->size * 2, a->buff); } void BPSNBA::xbpsnbaout (BPSNBA *a, int position) diff --git a/wdsp/cblock.cpp b/wdsp/cblock.cpp index 3dd6ed6c1..ae762d4b2 100644 --- a/wdsp/cblock.cpp +++ b/wdsp/cblock.cpp @@ -95,7 +95,7 @@ void CBL::xcbl (CBL *a) } } else if (a->in_buff != a->out_buff) - memcpy (a->out_buff, a->in_buff, a->buff_size * sizeof (wcomplex)); + std::copy(a->in_buff, a->in_buff + a->buff_size * 2, a->out_buff); } void CBL::setBuffers_cbl (CBL *a, float* in, float* out) diff --git a/wdsp/cfcomp.cpp b/wdsp/cfcomp.cpp index dd0b269ba..8eea1283a 100644 --- a/wdsp/cfcomp.cpp +++ b/wdsp/cfcomp.cpp @@ -387,7 +387,7 @@ void CFCOMP::xcfcomp (CFCOMP *a, int pos) } } else if (a->out != a->in) - memcpy (a->out, a->in, a->bsize * sizeof (wcomplex)); + std::copy(a->in, a->in + a->bsize * 2, a->out); } void CFCOMP::setBuffers_cfcomp (CFCOMP *a, float* in, float* out) diff --git a/wdsp/cfir.cpp b/wdsp/cfir.cpp index 540909ac1..e258a6637 100644 --- a/wdsp/cfir.cpp +++ b/wdsp/cfir.cpp @@ -98,7 +98,7 @@ void CFIR::xcfir (CFIR *a) if (a->run) FIRCORE::xfircore (a->p); else if (a->in != a->out) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } void CFIR::setBuffers_cfir (CFIR *a, float* in, float* out) diff --git a/wdsp/comm.hpp b/wdsp/comm.hpp index 61a7908f0..39ae81a03 100644 --- a/wdsp/comm.hpp +++ b/wdsp/comm.hpp @@ -74,12 +74,6 @@ warren@wpratt.com #define PI 3.1415926535897932 #define TWOPI 6.2831853071795864 -namespace WDSP { -// miscellaneous -typedef float wcomplex[2]; -typedef double dcomplex[2]; -} - #include #include #include diff --git a/wdsp/compress.cpp b/wdsp/compress.cpp index 6a4dff366..af32e0e9e 100644 --- a/wdsp/compress.cpp +++ b/wdsp/compress.cpp @@ -74,7 +74,7 @@ void COMPRESSOR::xcompressor (COMPRESSOR *a) a->outbuff[2 * i + 1] = 0.0; } else if (a->inbuff != a->outbuff) - memcpy(a->outbuff, a->inbuff, a->buffsize * sizeof (wcomplex)); + std::copy(a->inbuff, a->inbuff + a->buffsize * 2, a->outbuff); } void COMPRESSOR::setBuffers_compressor (COMPRESSOR *a, float* in, float* out) diff --git a/wdsp/delay.cpp b/wdsp/delay.cpp index d4a2400fc..03b68f20d 100644 --- a/wdsp/delay.cpp +++ b/wdsp/delay.cpp @@ -67,7 +67,7 @@ void DELAY::destroy_delay (DELAY *a) void DELAY::flush_delay (DELAY *a) { - memset (a->ring, 0, a->cpp * sizeof (wcomplex)); + std::fill(a->ring, a->ring + a->cpp * 2, 0); a->idx_in = 0; } @@ -105,7 +105,7 @@ void DELAY::xdelay (DELAY *a) } } else if (a->out != a->in) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } /******************************************************************************************************** diff --git a/wdsp/emph.cpp b/wdsp/emph.cpp index d6b2e2073..842b7ec90 100644 --- a/wdsp/emph.cpp +++ b/wdsp/emph.cpp @@ -76,7 +76,7 @@ void EMPHP::xemphp (EMPHP *a, int position) if (a->run && a->position == position) FIRCORE::xfircore (a->p); else if (a->in != a->out) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } void EMPHP::setBuffers_emphp (EMPHP *a, float* in, float* out) @@ -206,7 +206,7 @@ void EMPH::destroy_emph (EMPH *a) void EMPH::flush_emph (EMPH *a) { - memset (a->infilt, 0, 2 * a->size * sizeof (wcomplex)); + std::fill(a->infilt, a->infilt + 2 * a->size * 2, 0); } void EMPH::xemph (EMPH *a, int position) @@ -215,7 +215,7 @@ void EMPH::xemph (EMPH *a, int position) float I, Q; if (a->run && a->position == position) { - memcpy (&(a->infilt[2 * a->size]), a->in, a->size * sizeof (wcomplex)); + std::copy(a->in, a->in + a->size * 2, &(a->infilt[2 * a->size])); fftwf_execute (a->CFor); for (i = 0; i < 2 * a->size; i++) { @@ -225,10 +225,10 @@ void EMPH::xemph (EMPH *a, int position) a->product[2 * i + 1] = I * a->mults[2 * i + 1] + Q * a->mults[2 * i + 0]; } fftwf_execute (a->CRev); - memcpy (a->infilt, &(a->infilt[2 * a->size]), a->size * sizeof(wcomplex)); + std::copy(&(a->infilt[2 * a->size]), &(a->infilt[2 * a->size]) + a->size * 2, a->infilt); } else if (a->in != a->out) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } void EMPH::setBuffers_emph (EMPH *a, float* in, float* out) diff --git a/wdsp/eq.cpp b/wdsp/eq.cpp index 5f19c32f1..cd6e0ca4e 100644 --- a/wdsp/eq.cpp +++ b/wdsp/eq.cpp @@ -225,7 +225,7 @@ void EQP::xeqp (EQP *a) if (a->run) FIRCORE::xfircore (a->p); else - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } void EQP::setBuffers_eqp (EQP *a, float* in, float* out) @@ -579,7 +579,7 @@ void EQ::destroy_eq (EQ *a) void EQ::flush_eq (EQ *a) { - memset (a->infilt, 0, 2 * a->size * sizeof (wcomplex)); + std::fill(a->infilt, a->infilt + 2 * a->size * 2, 0); } void EQ::xeq (EQ *a) @@ -588,7 +588,7 @@ void EQ::xeq (EQ *a) float I, Q; if (a->run) { - memcpy (&(a->infilt[2 * a->size]), a->in, a->size * sizeof (wcomplex)); + std::copy(a->in, a->in + a->size * 2, &(a->infilt[2 * a->size])); fftwf_execute (a->CFor); for (i = 0; i < 2 * a->size; i++) { @@ -598,10 +598,10 @@ void EQ::xeq (EQ *a) a->product[2 * i + 1] = I * a->mults[2 * i + 1] + Q * a->mults[2 * i + 0]; } fftwf_execute (a->CRev); - memcpy (a->infilt, &(a->infilt[2 * a->size]), a->size * sizeof(wcomplex)); + std::copy(&(a->infilt[2 * a->size]), &(a->infilt[2 * a->size]) + a->size * 2, a->infilt); } else if (a->in != a->out) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } void EQ::setBuffers_eq (EQ *a, float* in, float* out) diff --git a/wdsp/fir.cpp b/wdsp/fir.cpp index 72da9307d..b600721df 100644 --- a/wdsp/fir.cpp +++ b/wdsp/fir.cpp @@ -33,13 +33,13 @@ namespace WDSP { float* FIR::fftcv_mults (int NM, float* c_impulse) { - float* mults = new float[NM * 2]; // (float *) malloc0 (NM * sizeof (wcomplex)); - float* cfft_impulse = new float[NM * 2]; // (float *) malloc0 (NM * sizeof (wcomplex)); + float* mults = new float[NM * 2]; + float* cfft_impulse = new float[NM * 2]; fftwf_plan ptmp = fftwf_plan_dft_1d(NM, (fftwf_complex *) cfft_impulse, (fftwf_complex *) mults, FFTW_FORWARD, FFTW_PATIENT); - memset (cfft_impulse, 0, NM * sizeof (wcomplex)); + std::fill(cfft_impulse, cfft_impulse + NM * 2, 0); // store complex coefs right-justified in the buffer - memcpy (&(cfft_impulse[NM - 2]), c_impulse, (NM / 2 + 1) * sizeof(wcomplex)); + std::copy(c_impulse, c_impulse + (NM / 2 + 1) * 2, &(cfft_impulse[NM - 2])); fftwf_execute (ptmp); fftwf_destroy_plan (ptmp); delete[] cfft_impulse; @@ -91,8 +91,8 @@ float* FIR::fir_fsamp_odd (int N, float* A, int rtype, float scale, int wintype) int mid = (N - 1) / 2; float mag, phs; float* window; - float *fcoef = new float[N * 2]; // (float *) malloc0 (N * sizeof (wcomplex)); - float *c_impulse = new float[N * 2]; // (float *) malloc0 (N * sizeof (wcomplex)); + float *fcoef = new float[N * 2]; + float *c_impulse = new float[N * 2]; fftwf_plan ptmp = fftwf_plan_dft_1d(N, (fftwf_complex *)fcoef, (fftwf_complex *)c_impulse, FFTW_BACKWARD, FFTW_PATIENT); float local_scale = 1.0 / (float)N; for (i = 0; i <= mid; i++) @@ -339,7 +339,7 @@ void FIR::mp_imp (int N, float* fir, float* mpfir, int pfactor, int polarity) float* ana = new float[size * 2]; // (float *) malloc0 (size * sizeof (complex)); float* impulse = new float[size * 2]; // (float *) malloc0 (size * sizeof (complex)); float* newfreq = new float[size * 2]; // (float *) malloc0 (size * sizeof (complex)); - memcpy (firpad, fir, N * sizeof (wcomplex)); + std::copy(fir, fir + N * 2, firpad); fftwf_plan pfor = fftwf_plan_dft_1d (size, (fftwf_complex *) firpad, (fftwf_complex *) firfreq, FFTW_FORWARD, FFTW_PATIENT); fftwf_plan prev = fftwf_plan_dft_1d (size, (fftwf_complex *) newfreq, @@ -365,9 +365,9 @@ void FIR::mp_imp (int N, float* fir, float* mpfir, int pfactor, int polarity) } fftwf_execute (prev); if (polarity) - memcpy (mpfir, &impulse[2 * (pfactor - 1) * N], N * sizeof (wcomplex)); + std::copy(&impulse[2 * (pfactor - 1) * N], &impulse[2 * (pfactor - 1) * N] + N * 2, mpfir); else - memcpy (mpfir, impulse, N * sizeof (wcomplex)); + std::copy(impulse, impulse + N * 2, mpfir); // print_impulse("min_imp.txt", N, mpfir, 1, 0); fftwf_destroy_plan (prev); fftwf_destroy_plan (pfor); diff --git a/wdsp/fircore.cpp b/wdsp/fircore.cpp index a1a71299b..6075eefb2 100644 --- a/wdsp/fircore.cpp +++ b/wdsp/fircore.cpp @@ -79,13 +79,13 @@ void FIRCORE::calc_fircore (FIRCORE *a, int flip) if (a->mp) FIR::mp_imp (a->nc, a->impulse, a->imp, 16, 0); else - memcpy (a->imp, a->impulse, a->nc * sizeof (wcomplex)); + std::copy(a->impulse, a->impulse + a->nc * 2, a->imp); for (i = 0; i < a->nfor; i++) { // I right-justified the impulse response => take output from left side of output buff, discard right side // Be careful about flipping an asymmetrical impulse response. - memcpy (&(a->maskgen[2 * a->size]), &(a->imp[2 * a->size * i]), a->size * sizeof(wcomplex)); + std::copy(&(a->imp[2 * a->size * i]), &(a->imp[2 * a->size * i]) + a->size * 2, &(a->maskgen[2 * a->size])); fftwf_execute (a->maskplan[1 - a->cset][i]); } @@ -110,7 +110,7 @@ FIRCORE* FIRCORE::create_fircore (int size, float* in, float* out, int nc, int m plan_fircore (a); a->impulse = new float[a->nc * 2]; // (float *) malloc0 (a->nc * sizeof (complex)); a->imp = new float[a->nc * 2]; // (float *) malloc0 (a->nc * sizeof (complex)); - memcpy (a->impulse, impulse, a->nc * sizeof (wcomplex)); + std::copy(impulse, impulse + a->nc * 2, a->impulse); calc_fircore (a, 1); return a; } @@ -152,19 +152,19 @@ void FIRCORE::destroy_fircore (FIRCORE *a) void FIRCORE::flush_fircore (FIRCORE *a) { int i; - memset (a->fftin, 0, 2 * a->size * sizeof (wcomplex)); + std::fill(a->fftin, a->fftin + 2 * a->size * 2, 0); for (i = 0; i < a->nfor; i++) - memset (a->fftout[i], 0, 2 * a->size * sizeof (wcomplex)); + std::fill(a->fftout[i], a->fftout[i] + 2 * a->size * 2, 0); a->buffidx = 0; } void FIRCORE::xfircore (FIRCORE *a) { int i, j, k; - memcpy (&(a->fftin[2 * a->size]), a->in, a->size * sizeof (wcomplex)); + std::copy(a->in, a->in + a->size * 2, &(a->fftin[2 * a->size])); fftwf_execute (a->pcfor[a->buffidx]); k = a->buffidx; - memset (a->accum, 0, 2 * a->size * sizeof (wcomplex)); + std::fill(a->accum, a->accum + 2 * a->size * 2, 0); for (j = 0; j < a->nfor; j++) { @@ -179,7 +179,7 @@ void FIRCORE::xfircore (FIRCORE *a) a->buffidx = (a->buffidx + 1) & a->idxmask; fftwf_execute (a->crev); - memcpy (a->fftin, &(a->fftin[2 * a->size]), a->size * sizeof(wcomplex)); + std::copy(&(a->fftin[2 * a->size]), &(a->fftin[2 * a->size]) + a->size * 2, a->fftin); } void FIRCORE::setBuffers_fircore (FIRCORE *a, float* in, float* out) @@ -201,7 +201,7 @@ void FIRCORE::setSize_fircore (FIRCORE *a, int size) void FIRCORE::setImpulse_fircore (FIRCORE *a, float* impulse, int update) { - memcpy (a->impulse, impulse, a->nc * sizeof (wcomplex)); + std::copy(impulse, impulse + a->nc * 2, a->impulse); calc_fircore (a, update); } @@ -215,7 +215,7 @@ void FIRCORE::setNc_fircore (FIRCORE *a, int nc, float* impulse) plan_fircore (a); a->imp = new float[a->nc * 2]; // (float *) malloc0 (a->nc * sizeof (complex)); a->impulse = new float[a->nc * 2]; // (float *) malloc0 (a->nc * sizeof (complex)); - memcpy (a->impulse, impulse, a->nc * sizeof (wcomplex)); + std::copy(impulse, impulse + a->nc * 2, a->impulse); calc_fircore (a, 1); } diff --git a/wdsp/firmin.cpp b/wdsp/firmin.cpp index d11c4c8e1..d3e289bc4 100644 --- a/wdsp/firmin.cpp +++ b/wdsp/firmin.cpp @@ -74,7 +74,7 @@ void FIRMIN::destroy_firmin (FIRMIN *a) void FIRMIN::flush_firmin (FIRMIN *a) { - memset (a->ring, 0, a->rsize * sizeof (wcomplex)); + std::fill(a->ring, a->ring + a->rsize * 2, 0); a->idx = 0; } @@ -100,7 +100,7 @@ void FIRMIN::xfirmin (FIRMIN *a, int pos) } } else if (a->in != a->out) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } void FIRMIN::setBuffers_firmin (FIRMIN *a, float* in, float* out) diff --git a/wdsp/firopt.cpp b/wdsp/firopt.cpp index 73e451a3a..8b737654e 100644 --- a/wdsp/firopt.cpp +++ b/wdsp/firopt.cpp @@ -72,7 +72,7 @@ void FIROPT::calc_firopt (FIROPT *a) { // I right-justified the impulse response => take output from left side of output buff, discard right side // Be careful about flipping an asymmetrical impulse response. - memcpy (&(a->maskgen[2 * a->size]), &(impulse[2 * a->size * i]), a->size * sizeof(wcomplex)); + std::copy(&(impulse[2 * a->size * i]), &(impulse[2 * a->size * i]) + a->size * 2, &(a->maskgen[2 * a->size])); fftwf_execute (a->maskplan[i]); } delete[] (impulse); @@ -127,9 +127,9 @@ void FIROPT::destroy_firopt (FIROPT *a) void FIROPT::flush_firopt (FIROPT *a) { int i; - memset (a->fftin, 0, 2 * a->size * sizeof (wcomplex)); + std::fill(a->fftin, a->fftin + 2 * a->size * 2, 0); for (i = 0; i < a->nfor; i++) - memset (a->fftout[i], 0, 2 * a->size * sizeof (wcomplex)); + std::fill(a->fftout[i], a->fftout[i] + 2 * a->size * 2, 0); a->buffidx = 0; } @@ -138,10 +138,10 @@ void FIROPT::xfiropt (FIROPT *a, int pos) if (a->run && (a->position == pos)) { int i, j, k; - memcpy (&(a->fftin[2 * a->size]), a->in, a->size * sizeof (wcomplex)); + std::copy(a->in, a->in + a->size * 2, &(a->fftin[2 * a->size])); fftwf_execute (a->pcfor[a->buffidx]); k = a->buffidx; - memset (a->accum, 0, 2 * a->size * sizeof (wcomplex)); + std::fill(a->accum, a->accum + 2 * a->size * 2, 0); for (j = 0; j < a->nfor; j++) { for (i = 0; i < 2 * a->size; i++) @@ -153,10 +153,10 @@ void FIROPT::xfiropt (FIROPT *a, int pos) } a->buffidx = (a->buffidx + 1) & a->idxmask; fftwf_execute (a->crev); - memcpy (a->fftin, &(a->fftin[2 * a->size]), a->size * sizeof(wcomplex)); + std::copy(&(a->fftin[2 * a->size]), &(a->fftin[2 * a->size]) + a->size * 2, a->fftin); } else if (a->in != a->out) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } void FIROPT::setBuffers_firopt (FIROPT *a, float* in, float* out) diff --git a/wdsp/fmd.cpp b/wdsp/fmd.cpp index 61c2c50b8..e4780e628 100644 --- a/wdsp/fmd.cpp +++ b/wdsp/fmd.cpp @@ -160,7 +160,7 @@ void FMD::destroy_fmd (FMD *a) void FMD::flush_fmd (FMD *a) { - memset (a->audio, 0, a->size * sizeof (wcomplex)); + std::fill(a->audio, a->audio + a->size * 2, 0); FIRCORE::flush_fircore (a->pde); FIRCORE::flush_fircore (a->paud); a->phs = 0.0; @@ -214,7 +214,7 @@ void FMD::xfmd (FMD *a) } } else if (a->in != a->out) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } void FMD::setBuffers_fmd (FMD *a, float* in, float* out) diff --git a/wdsp/fmmod.cpp b/wdsp/fmmod.cpp index 533527baf..3d400ac51 100644 --- a/wdsp/fmmod.cpp +++ b/wdsp/fmmod.cpp @@ -127,7 +127,7 @@ void FMMOD::xfmmod (FMMOD *a) FIRCORE::xfircore (a->p); } else if (a->in != a->out) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } void FMMOD::setBuffers_fmmod (FMMOD *a, float* in, float* out) diff --git a/wdsp/fmsq.cpp b/wdsp/fmsq.cpp index f357d1402..4e2d3124d 100644 --- a/wdsp/fmsq.cpp +++ b/wdsp/fmsq.cpp @@ -228,7 +228,7 @@ void FMSQ::xfmsq (FMSQ *a) } } else if (a->insig != a->outsig) - memcpy (a->outsig, a->insig, a->size * sizeof (wcomplex)); + std::copy(a->insig, a->insig + a->size * 2, a->outsig); } void FMSQ::setBuffers_fmsq (FMSQ *a, float* in, float* out, float* trig) diff --git a/wdsp/gain.cpp b/wdsp/gain.cpp index d48b64ed8..681c84059 100644 --- a/wdsp/gain.cpp +++ b/wdsp/gain.cpp @@ -73,7 +73,7 @@ void GAIN::xgain (GAIN *a) } } else if (a->in != a->out) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } void GAIN::setBuffers_gain (GAIN *a, float* in, float* out) diff --git a/wdsp/gen.cpp b/wdsp/gen.cpp index 131b475b2..fc81e65c0 100644 --- a/wdsp/gen.cpp +++ b/wdsp/gen.cpp @@ -351,13 +351,13 @@ void GEN::xgen (GEN *a) break; default: // silence { - memset (a->out, 0, a->size * sizeof (wcomplex)); + std::fill(a->out, a->out + a->size * 2, 0); break; } } } else if (a->in != a->out) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } void GEN::setBuffers_gen (GEN *a, float* in, float* out) diff --git a/wdsp/icfir.cpp b/wdsp/icfir.cpp index 5f52153e3..dd7b8546c 100644 --- a/wdsp/icfir.cpp +++ b/wdsp/icfir.cpp @@ -113,7 +113,7 @@ void ICFIR::xicfir (ICFIR *a) if (a->run) FIRCORE::xfircore (a->p); else if (a->in != a->out) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } void ICFIR::setBuffers_icfir (ICFIR *a, float* in, float* out) diff --git a/wdsp/iir.cpp b/wdsp/iir.cpp index ee307ee86..01cfea88a 100644 --- a/wdsp/iir.cpp +++ b/wdsp/iir.cpp @@ -93,7 +93,7 @@ void SNOTCH::xsnotch (SNOTCH *a) } } else if (a->out != a->in) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } void SNOTCH::setBuffers_snotch (SNOTCH *a, float* in, float* out) @@ -289,7 +289,7 @@ void SPEAK::xspeak (SPEAK *a) } } else if (a->out != a->in) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } void SPEAK::setBuffers_speak (SPEAK *a, float* in, float* out) @@ -426,7 +426,7 @@ void MPEAK::xmpeak (MPEAK *a) if (a->run) { int i, j; - memset (a->mix, 0, a->size * sizeof (wcomplex)); + std::fill(a->mix, a->mix + a->size * 2, 0); for (i = 0; i < a->npeaks; i++) { @@ -438,11 +438,11 @@ void MPEAK::xmpeak (MPEAK *a) } } - memcpy (a->out, a->mix, a->size * sizeof (wcomplex)); + std::copy(a->mix, a->mix + a->size * 2, a->out); } else if (a->in != a->out) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } void MPEAK::setBuffers_mpeak (MPEAK *a, float* in, float* out) @@ -601,7 +601,7 @@ void PHROT::xphrot (PHROT *a) } } else if (a->out != a->in) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } void PHROT::setBuffers_phrot (PHROT *a, float* in, float* out) @@ -755,7 +755,7 @@ void BQLP::xbqlp(BQLP *a) } } else if (a->out != a->in) - memcpy(a->out, a->in, a->size * sizeof(wcomplex)); + std::copy(a->in, a->in + a->size * 2, a->out); } void BQLP::setBuffers_bqlp(BQLP *a, float* in, float* out) @@ -992,7 +992,7 @@ void BQBP::xbqbp(BQBP *a) } } else if (a->out != a->in) - memcpy(a->out, a->in, a->size * sizeof(wcomplex)); + std::copy(a->in, a->in + a->size * 2, a->out); } void BQBP::setBuffers_bqbp(BQBP *a, float* in, float* out) @@ -1180,10 +1180,10 @@ void SPHP::destroy_sphp(SPHP *a) void SPHP::flush_sphp(SPHP *a) { - memset(a->x0, 0, a->nstages * sizeof(wcomplex)); - memset(a->x1, 0, a->nstages * sizeof(wcomplex)); - memset(a->y0, 0, a->nstages * sizeof(wcomplex)); - memset(a->y1, 0, a->nstages * sizeof(wcomplex)); + std::fill(a->x0, a->x0 + a->nstages * 2, 0); + std::fill(a->x1, a->x0 + a->nstages * 2, 0); + std::fill(a->y0, a->x0 + a->nstages * 2, 0); + std::fill(a->y1, a->x0 + a->nstages * 2, 0); } void SPHP::xsphp(SPHP *a) @@ -1214,7 +1214,7 @@ void SPHP::xsphp(SPHP *a) } } else if (a->out != a->in) - memcpy(a->out, a->in, a->size * sizeof(wcomplex)); + std::copy(a->in, a->in + a->size * 2, a->out); } void SPHP::setBuffers_sphp(SPHP *a, float* in, float* out) diff --git a/wdsp/iqc.cpp b/wdsp/iqc.cpp index 96e07e67d..4f273ad24 100644 --- a/wdsp/iqc.cpp +++ b/wdsp/iqc.cpp @@ -203,7 +203,7 @@ void IQC::xiqc (IQC *a) } } else if (a->out != a->in) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } void IQC::setBuffers_iqc (IQC *a, float* in, float* out) diff --git a/wdsp/nbp.cpp b/wdsp/nbp.cpp index a279245d8..17a88d51c 100644 --- a/wdsp/nbp.cpp +++ b/wdsp/nbp.cpp @@ -363,7 +363,7 @@ void NBP::xnbp (NBP *a, int pos) if (a->run && pos == a->position) FIRCORE::xfircore (a->p); else if (a->in != a->out) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } void NBP::setBuffers_nbp (NBP *a, float* in, float* out) diff --git a/wdsp/nob.cpp b/wdsp/nob.cpp index 511681366..68860bb93 100644 --- a/wdsp/nob.cpp +++ b/wdsp/nob.cpp @@ -150,10 +150,10 @@ void NOB::flush_nob (NOB *a) a->avg = 1.0; a->bfb_in_idx = a->filterlen - 1; a->ffb_in_idx = a->filterlen - 1; - memset (a->dline, 0, a->dline_size * sizeof (wcomplex)); - memset (a->imp, 0, a->dline_size * sizeof (int)); - memset (a->bfbuff, 0, a->filterlen * sizeof (wcomplex)); - memset (a->ffbuff, 0, a->filterlen * sizeof (wcomplex)); + std::fill(a->dline, a->dline + a->dline_size * 2, 0); + std::fill(a->imp, a->imp + a->dline_size, 0); + std::fill(a->bfbuff, a->bfbuff + a->filterlen * 2, 0); + std::fill(a->ffbuff, a->ffbuff + a->filterlen * 2, 0); } void NOB::xnob (NOB *a) @@ -491,7 +491,7 @@ void NOB::xnob (NOB *a) } } else if (a->in != a->out) - memcpy (a->out, a->in, a->buffsize * sizeof (wcomplex)); + std::copy(a->in, a->in + a->buffsize * 2, a->out); } void NOB::setBuffers_nob (NOB *a, float* in, float* out) diff --git a/wdsp/osctrl.cpp b/wdsp/osctrl.cpp index 6098f6499..aee850633 100644 --- a/wdsp/osctrl.cpp +++ b/wdsp/osctrl.cpp @@ -83,8 +83,8 @@ void OSCTRL::destroy_osctrl (OSCTRL *a) void OSCTRL::flush_osctrl (OSCTRL *a) { - memset (a->dl, 0, a->dl_len * sizeof (wcomplex)); - memset (a->dlenv, 0, a->pn * sizeof (float)); + std::fill(a->dl, a->dl + a->dl_len * 2, 0); + std::fill(a->dlenv, a->dlenv + a->pn, 0); } void OSCTRL::xosctrl (OSCTRL *a) @@ -116,7 +116,7 @@ void OSCTRL::xosctrl (OSCTRL *a) } } else if (a->inbuff != a->outbuff) - memcpy (a->outbuff, a->inbuff, a->size * sizeof (wcomplex)); + std::copy(a->inbuff, a->inbuff + a->size * 2, a->outbuff); } void OSCTRL::setBuffers_osctrl (OSCTRL *a, float* in, float* out) diff --git a/wdsp/resample.cpp b/wdsp/resample.cpp index 6cc1b845a..ac182a80d 100644 --- a/wdsp/resample.cpp +++ b/wdsp/resample.cpp @@ -166,7 +166,7 @@ int RESAMPLE::xresample (RESAMPLE *a) } } else if (a->in != a->out) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); return outsamps; } diff --git a/wdsp/rmatch.cpp b/wdsp/rmatch.cpp index e17c893d6..21fd0ffed 100644 --- a/wdsp/rmatch.cpp +++ b/wdsp/rmatch.cpp @@ -334,8 +334,8 @@ void RMATCH::xrmatchIN (void* b, float* in) second = 0; } - memcpy (a->baux, a->ring + 2 * a->iout, first * sizeof (wcomplex)); - memcpy (a->baux + 2 * first, a->ring, second * sizeof (wcomplex)); + std::copy(a->ring + 2 * a->iout, a->ring + 2 * a->iout + first * 2, a->baux); + std::copy(a->ring, a->ring + second * 2, a->baux + 2 * first); // a->iout = (a->iout + ovfl + a->rsize / 2) % a->rsize; a->iout = (a->iout + ovfl) % a->rsize; // } @@ -351,8 +351,8 @@ void RMATCH::xrmatchIN (void* b, float* in) second = 0; } - memcpy (a->ring + 2 * a->iin, a->resout, first * sizeof (wcomplex)); - memcpy (a->ring, a->resout + 2 * first, second * sizeof (wcomplex)); + std::copy(a->resout, a->resout + first * 2, a->ring + 2 * a->iin); + std::copy(a->resout + 2 * first, a->resout + 2 * first + second * 2, a->ring); if (a->ucnt >= 0) upslew(a, newsamps); @@ -427,8 +427,8 @@ void RMATCH::dslew (RMATCH *a) first = zeros; second = 0; } - memset (a->ring + 2 * i, 0, first * sizeof (wcomplex)); - memset (a->ring, 0, second * sizeof (wcomplex)); + std::fill(a->ring + 2 * i, a->ring + 2 * i + first * 2, 0); + std::fill(a->ring, a->ring + second * 2, 0); n += zeros; // } // // a->n_ring = a->outsize + a->rsize / 2; @@ -464,8 +464,8 @@ void RMATCH::xrmatchOUT (void* b, float* out) second = 0; } - memcpy (a->out, a->ring + 2 * a->iout, first * sizeof (wcomplex)); - memcpy (a->out + 2 * first, a->ring, second * sizeof (wcomplex)); + std::copy(a->ring + 2 * a->iout, a->ring + 2 * a->iout + first * 2, a->out); + std::copy(a->ring, a->ring + second * 2, a->out + 2 * first); a->iout = (a->iout + a->outsize) % a->rsize; a->n_ring -= a->outsize; a->dlast[0] = a->out[2 * (a->outsize - 1) + 0]; diff --git a/wdsp/shift.cpp b/wdsp/shift.cpp index 132e8635f..67f9a9f71 100644 --- a/wdsp/shift.cpp +++ b/wdsp/shift.cpp @@ -86,7 +86,7 @@ void SHIFT::xshift (SHIFT *a) } } else if (a->in != a->out) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } void SHIFT::setBuffers_shift(SHIFT *a, float* in, float* out) diff --git a/wdsp/siphon.cpp b/wdsp/siphon.cpp index eb21c88e4..1d3384901 100644 --- a/wdsp/siphon.cpp +++ b/wdsp/siphon.cpp @@ -101,9 +101,9 @@ void SIPHON::destroy_siphon (SIPHON *a) void SIPHON::flush_siphon (SIPHON *a) { - memset (a->sipbuff, 0, a->sipsize * sizeof (wcomplex)); - memset (a->sipout , 0, a->sipsize * sizeof (wcomplex)); - memset (a->specout, 0, a->fftsize * sizeof (wcomplex)); + std::fill(a->sipbuff, a->sipbuff + a->sipsize * 2, 0); + std::fill(a->sipout, a->sipout + a->sipsize * 2, 0); + std::fill(a->specout, a->specout + a->fftsize * 2, 0); a->idx = 0; } @@ -117,7 +117,7 @@ void SIPHON::xsiphon (SIPHON *a, int pos) { case 0: if (a->insize >= a->sipsize) - memcpy (a->sipbuff, &(a->in[2 * (a->insize - a->sipsize)]), a->sipsize * sizeof (wcomplex)); + std::copy(&(a->in[2 * (a->insize - a->sipsize)]), &(a->in[2 * (a->insize - a->sipsize)]) + a->sipsize * 2, a->sipbuff); else { if (a->insize > (a->sipsize - a->idx)) @@ -130,8 +130,8 @@ void SIPHON::xsiphon (SIPHON *a, int pos) first = a->insize; second = 0; } - memcpy (a->sipbuff + 2 * a->idx, a->in, first * sizeof (wcomplex)); - memcpy (a->sipbuff, a->in + 2 * first, second * sizeof (wcomplex)); + std::copy(a->in, a->in + first * 2, a->sipbuff + 2 * a->idx); + std::copy(a->in + 2 * first, a->in + 2 * first + second * 2, a->sipbuff); if ((a->idx += a->insize) >= a->sipsize) a->idx -= a->sipsize; } break; @@ -166,11 +166,11 @@ void SIPHON::suck (SIPHON *a) int j = (a->idx - a->outsize) & mask; int size = a->sipsize - j; if (size >= a->outsize) - memcpy (a->sipout, &(a->sipbuff[2 * j]), a->outsize * sizeof (wcomplex)); + std::copy(&(a->sipbuff[2 * j]), &(a->sipbuff[2 * j]) + a->outsize * 2, a->sipout); else { - memcpy (a->sipout, &(a->sipbuff[2 * j]), size * sizeof (wcomplex)); - memcpy (&(a->sipout[2 * size]), a->sipbuff, (a->outsize - size) * sizeof (wcomplex)); + std::copy(&(a->sipbuff[2 * j]), &(a->sipbuff[2 * j]) + size * 2, a->sipout); + std::copy(a->sipbuff, a->sipbuff + (a->outsize - size) * 2, &(a->sipout[2 * size])); } } } diff --git a/wdsp/slew.cpp b/wdsp/slew.cpp index ef6eeb10c..0a9814f18 100644 --- a/wdsp/slew.cpp +++ b/wdsp/slew.cpp @@ -167,7 +167,7 @@ void USLEW::xuslew (USLEW *a) } } else if (a->out != a->in) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); } void USLEW::setBuffers_uslew (USLEW *a, float* in, float* out) diff --git a/wdsp/snba.cpp b/wdsp/snba.cpp index fc6e49cbe..28eab140f 100644 --- a/wdsp/snba.cpp +++ b/wdsp/snba.cpp @@ -240,8 +240,8 @@ void SNBA::flush_snba (SNBA *d) memset (d->sdet.vp, 0, d->xsize * sizeof (double)); memset (d->sdet.vpwr, 0, d->xsize * sizeof (double)); - memset (d->inbuff, 0, d->isize * sizeof (wcomplex)); - memset (d->outbuff, 0, d->isize * sizeof (wcomplex)); + std::fill(d->inbuff, d->inbuff + d->isize * 2, 0); + std::fill(d->outbuff, d->outbuff + d->isize * 2, 0); RESAMPLE::flush_resample (d->inresamp); RESAMPLE::flush_resample (d->outresamp); @@ -673,7 +673,7 @@ void SNBA::xsnba (SNBA *d) RESAMPLE::xresample (d->outresamp); } else if (d->out != d->in) - memcpy (d->out, d->in, d->bsize * sizeof (wcomplex)); + std::copy(d->in, d->in + d->bsize * 2, d->out); } /******************************************************************************************************** diff --git a/wdsp/ssql.cpp b/wdsp/ssql.cpp index 508b2a453..a0d3d511b 100644 --- a/wdsp/ssql.cpp +++ b/wdsp/ssql.cpp @@ -229,7 +229,7 @@ void SSQL::destroy_ssql (SSQL *a) void SSQL::flush_ssql (SSQL *a) { - memset (a->b1, 0, a->size * sizeof (wcomplex)); + std::fill(a->b1, a->b1 + a->size * 2, 0); CBL::flush_cbl (a->dcbl); memset (a->ibuff, 0, a->size * sizeof (float)); memset (a->ftovbuff, 0, a->size * sizeof (float)); @@ -317,7 +317,7 @@ void SSQL::xssql (SSQL *a) } } else if (a->in != a->out) - memcpy (a->out, a->in, a->size * sizeof(wcomplex)); + std::copy(a->in, a->in + a->size * 2, a->out); } void SSQL::setBuffers_ssql (SSQL *a, float* in, float* out) diff --git a/wdsp/varsamp.cpp b/wdsp/varsamp.cpp index c7b080c5d..5a9e3c7f3 100644 --- a/wdsp/varsamp.cpp +++ b/wdsp/varsamp.cpp @@ -120,7 +120,7 @@ void VARSAMP::destroy_varsamp (VARSAMP *a) void VARSAMP::flush_varsamp (VARSAMP *a) { - memset (a->ring, 0, a->rsize * sizeof (wcomplex)); + std::fill(a->ring, a->ring + a->rsize * 2, 0); a->idx_in = a->rsize - 1; a->h_offset = 0.0; a->isamps = 0.0; @@ -191,7 +191,7 @@ int VARSAMP::xvarsamp (VARSAMP *a, float var) } } else if (a->in != a->out) - memcpy (a->out, a->in, a->size * sizeof (wcomplex)); + std::copy( a->in, a->in + a->size * 2, a->out); return outsamps; } diff --git a/wdsp/wcpAGC.cpp b/wdsp/wcpAGC.cpp index 53e5d219c..824a73477 100644 --- a/wdsp/wcpAGC.cpp +++ b/wdsp/wcpAGC.cpp @@ -345,7 +345,7 @@ void WCPAGC::xwcpagc (WCPAGC *a) } } else if (a->out != a->in) - memcpy(a->out, a->in, a->io_buffsize * sizeof (wcomplex)); + std::copy(a->in, a->in + a->io_buffsize * 2, a->out); } void WCPAGC::setBuffers_wcpagc (WCPAGC *a, float* in, float* out)