Skip to content

Commit 6dd3a6b

Browse files
fix sonar findings
1 parent 5df44dc commit 6dd3a6b

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

‎numerical/analysis/SignalDetectors.hpp‎

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ namespace analysis
1818

1919
public:
2020
explicit PeakHold(T decay = T{ 1 })
21-
: peak{ T{ 0 } }
22-
, decay{ decay }
21+
: decay{ decay }
2322
{}
2423

2524
OPTIMIZE_FOR_SPEED T Update(T x)
@@ -35,7 +34,7 @@ namespace analysis
3534
}
3635

3736
private:
38-
T peak;
37+
T peak{ T{ 0 } };
3938
T decay;
4039
};
4140

@@ -46,9 +45,7 @@ namespace analysis
4645

4746
public:
4847
explicit ZeroCrossingCounter(T hysteresis = T{ 0 })
49-
: previous{ T{ 0 } }
50-
, count{ 0 }
51-
, hysteresis{ hysteresis }
48+
: hysteresis{ hysteresis }
5249
{}
5350

5451
OPTIMIZE_FOR_SPEED bool Update(T x)
@@ -72,8 +69,8 @@ namespace analysis
7269
}
7370

7471
private:
75-
T previous;
76-
uint32_t count;
72+
T previous{ T{ 0 } };
73+
uint32_t count{ 0 };
7774
T hysteresis;
7875
};
7976

@@ -85,7 +82,6 @@ namespace analysis
8582
public:
8683
explicit RmsEnvelope(T alpha)
8784
: alpha{ alpha }
88-
, meanSquare{ T{ 0 } }
8985
{}
9086

9187
OPTIMIZE_FOR_SPEED T Update(T x)
@@ -101,7 +97,7 @@ namespace analysis
10197

10298
private:
10399
T alpha;
104-
T meanSquare;
100+
T meanSquare{ T{ 0 } };
105101
};
106102

107103
#ifdef NUMERICAL_TOOLBOX_COVERAGE_BUILD

0 commit comments

Comments
 (0)