From 4e31e95cb3a1df6c679543282b5a4bae27e40922 Mon Sep 17 00:00:00 2001 From: Paul Date: Sat, 21 Sep 2024 17:56:55 -0400 Subject: [PATCH] Push towards better const (#137) Changing voice effects to be const float * const and so these are the first echoes of that down onto the underlying ops. --- include/sst/basic-blocks/dsp/BlockInterpolators.h | 7 ++++--- include/sst/basic-blocks/dsp/MidSide.h | 6 ++++-- include/sst/basic-blocks/mechanics/block-ops.h | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/sst/basic-blocks/dsp/BlockInterpolators.h b/include/sst/basic-blocks/dsp/BlockInterpolators.h index b5a3243..622e18a 100644 --- a/include/sst/basic-blocks/dsp/BlockInterpolators.h +++ b/include/sst/basic-blocks/dsp/BlockInterpolators.h @@ -146,7 +146,8 @@ template struct alignas(16) lip * that the port is correct so for now we add a block size quad argument to these * and assert that they are correct. */ - void multiply_block_to(float *__restrict in, float *__restrict out, int bsQuad = -1) const + void multiply_block_to(const float *__restrict const in, float *__restrict out, + int bsQuad = -1) const { assert(bsQuad == -1 || bsQuad == numRegisters); for (int i = 0; i < numRegisters; ++i) @@ -174,8 +175,8 @@ template struct alignas(16) lip multiply_block(in2, bsQuad); } - void multiply_2_blocks_to(float *__restrict inL, float *__restrict inR, float *__restrict outL, - float *__restrict outR, int bsQuad = -1) const + void multiply_2_blocks_to(const float *__restrict const inL, const float *__restrict const inR, + float *__restrict outL, float *__restrict outR, int bsQuad = -1) const { multiply_block_to(inL, outL, bsQuad); multiply_block_to(inR, outR, bsQuad); diff --git a/include/sst/basic-blocks/dsp/MidSide.h b/include/sst/basic-blocks/dsp/MidSide.h index db8f346..ec297bc 100644 --- a/include/sst/basic-blocks/dsp/MidSide.h +++ b/include/sst/basic-blocks/dsp/MidSide.h @@ -30,7 +30,8 @@ namespace sst::basic_blocks::dsp { template -void encodeMS(float *__restrict L, float *__restrict R, float *__restrict M, float *__restrict S) +void encodeMS(const float *__restrict const L, const float *__restrict const R, float *__restrict M, + float *__restrict S) { for (auto i = 0U; i < blocksize; ++i) { @@ -40,7 +41,8 @@ void encodeMS(float *__restrict L, float *__restrict R, float *__restrict M, flo } template -void decodeMS(float *__restrict M, float *__restrict S, float *__restrict L, float *__restrict R) +void decodeMS(const float *__restrict const M, const float *__restrict const S, float *__restrict L, + float *__restrict R) { for (auto i = 0U; i < blocksize; ++i) { diff --git a/include/sst/basic-blocks/mechanics/block-ops.h b/include/sst/basic-blocks/mechanics/block-ops.h index 45dbe83..9901aad 100644 --- a/include/sst/basic-blocks/mechanics/block-ops.h +++ b/include/sst/basic-blocks/mechanics/block-ops.h @@ -95,7 +95,8 @@ inline void add_block(float *__restrict srcdst, const float *__restrict src2) } template -inline void mul_block(float *__restrict src1, float *src2, float *__restrict dst) +inline void mul_block(const float *__restrict const src1, const float *const src2, + float *__restrict dst) { for (auto i = 0U; i < blockSize; ++i) {