So you decided to change the "if (!signe)" branch instead. I mean the recent 
commit
e6a622fa495 ("Expressions '0-x' rewritten in '-1*x' in 
aterm::normalizedTree().")

OK. to be honest I have some concerns about this patch... In particular I still 
think
that the special "ksub && izZero" case in simplification() should die, but 
perhaps
I am wrong. I'll recheck later.

Neverming. Let me report another minor/unrelated optimization problem first. 
Consider

        import("stdfaust.lib");
        k = ma.SR;
        process(x) = -k*x;
=>
        void instanceConstants(int sample_rate)
        {
                fSampleRate = sample_rate;
                fConst0 = std::min<float>(1.92e+05f, std::max<float>(1.0f, 
float(fSampleRate)));
        }

        void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs)
        {
                FAUSTFLOAT* input0 = inputs[0];
                FAUSTFLOAT* output0 = outputs[0];
                for (int i0 = 0; i0 < count; i0 = i0 + 1) {
                        output0[i0] = FAUSTFLOAT(-1.0f * fConst0 * 
float(input0[i0]));
                }
        }

OK. not "perfect" but OK. But,

        import("stdfaust.lib");
        k = ma.SR;
        process(x) = -k, -k*x;
=>
        void instanceConstants(int sample_rate)
        {
                fSampleRate = sample_rate;
                fConst0 = std::min<float>(1.92e+05f, std::max<float>(1.0f, 
float(fSampleRate)));
                fConst1 = -1.0f * fConst0;
        }

        void compute(int count, FAUSTFLOAT** inputs, FAUSTFLOAT** outputs)
        {
                FAUSTFLOAT* input0 = inputs[0];
                FAUSTFLOAT* output0 = outputs[0];
                FAUSTFLOAT* output1 = outputs[1];
                for (int i0 = 0; i0 < count; i0 = i0 + 1) {
                        output0[i0] = FAUSTFLOAT(fConst1);
                        output1[i0] = FAUSTFLOAT(-1.0f * fConst0 * 
float(input0[i0]));
                }
        }

certainly doesn't look "really good" to me. In any case compiler should not blow
"struct dsp" with 2 fConst's.

Oleg.



_______________________________________________
Faudiostream-devel mailing list
Faudiostream-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/faudiostream-devel

Reply via email to