Skip to content

Commit

Permalink
Push towards better const (#137)
Browse files Browse the repository at this point in the history
Changing voice effects to be const float * const and so these
are the first echoes of that down onto the underlying ops.
  • Loading branch information
baconpaul authored Sep 21, 2024
1 parent 821c9f3 commit 4e31e95
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
7 changes: 4 additions & 3 deletions include/sst/basic-blocks/dsp/BlockInterpolators.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ template <int maxBlockSize, bool first_run_checks = true> 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)
Expand Down Expand Up @@ -174,8 +175,8 @@ template <int maxBlockSize, bool first_run_checks = true> 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);
Expand Down
6 changes: 4 additions & 2 deletions include/sst/basic-blocks/dsp/MidSide.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
namespace sst::basic_blocks::dsp
{
template <size_t blocksize>
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)
{
Expand All @@ -40,7 +41,8 @@ void encodeMS(float *__restrict L, float *__restrict R, float *__restrict M, flo
}

template <size_t blocksize>
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)
{
Expand Down
3 changes: 2 additions & 1 deletion include/sst/basic-blocks/mechanics/block-ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ inline void add_block(float *__restrict srcdst, const float *__restrict src2)
}

template <size_t blockSize>
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)
{
Expand Down

0 comments on commit 4e31e95

Please sign in to comment.