Skip to content

Conversation

@aleksandarkoruga
Copy link

added const-ness and proper initialization.

added const-ness and proper initialization.
struct State {
Array real, imag;
};
State newState;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this need to be in the class, instead of a stack variable?

Copy link
Contributor

@geraintluff geraintluff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I might not understand what this is fixing. Could you give an example of the warning/error you get, or the unexpected behaviour this is preventing?

// Really we're just doing: state[i] = state[i]*poles[i] + x*coeffs[i]
// but std::complex is slow without -ffast-math, so we've unwrapped it
State state = states[channel], newState;
State& state = states[channel];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is changing this to a reference deliberate?

}

Complex operator()(Sample x, int channel=0) {
std::pair<Sample, Sample> operator()(Sample x, int channel=0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an advantage over Complex, and shouldn't this match the other operator() as well?

struct HilbertIIRCoeffs {
static constexpr int order = 12;
std::array<std::complex<Sample>, order> coeffs{{
const std::array<std::complex<Sample>, order> coeffs{{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were these giving warnings in a particular compiler, without const? Or was this for tidiness? 😄

@geraintluff
Copy link
Contributor

Hi @aleksandarkoruga! Just checking in to see if you'd read my comments. I appreciate the PR, but just need to understand it fully before I can do anything with it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants