mirror of
https://github.com/aicodix/dsp.git
synced 2026-04-27 14:30:36 +00:00
initialize buffer with provided neutral element
This commit is contained in:
parent
0ccdcfd979
commit
18a72daa4c
2 changed files with 5 additions and 2 deletions
3
sma.hh
3
sma.hh
|
|
@ -85,6 +85,9 @@ class SMA4
|
||||||
struct Add { TYPE operator () (TYPE a, TYPE b) { return a + b; } };
|
struct Add { TYPE operator () (TYPE a, TYPE b) { return a + b; } };
|
||||||
SWA<TYPE, Add, NUM> swa;
|
SWA<TYPE, Add, NUM> swa;
|
||||||
public:
|
public:
|
||||||
|
SMA4() : swa(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
TYPE operator () (TYPE input)
|
TYPE operator () (TYPE input)
|
||||||
{
|
{
|
||||||
if (NORM)
|
if (NORM)
|
||||||
|
|
|
||||||
4
swa.hh
4
swa.hh
|
|
@ -15,10 +15,10 @@ class SWA
|
||||||
int leaf;
|
int leaf;
|
||||||
OP op;
|
OP op;
|
||||||
public:
|
public:
|
||||||
SWA() : leaf(NUM)
|
SWA(TYPE ident) : leaf(NUM)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 2 * NUM; ++i)
|
for (int i = 0; i < 2 * NUM; ++i)
|
||||||
tree[i] = 0;
|
tree[i] = ident;
|
||||||
}
|
}
|
||||||
TYPE operator () (TYPE input)
|
TYPE operator () (TYPE input)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue