LMMS/lmms — pull request #564 by diizy (2014-04-04 22:39:19+00:00)
Title: Optimize linear interpolation function

Not going to have an actual effect on anything since the function isn't actually used anywhere currently. But I think there are maybe several places where it could be used, so it's good to do some optimization first.

The algorithm comes in two forms here, one utilizing fma, another not.

The non-fma form is a bit different from the "standard" form of linear-ip, and it's not necessarily always 100% accurate due to floating-point weirdness, although with our usecases it *mostly* should be. In any case we don't really require 100% accuracy, and it's one less operation so it should be very slightly faster.

The fma form may provide some additional speed to people who use newer cpu's and compile from source. The macro should be provided by math.h to indicate whether there's benefit in using fmaf vs. regular fp arithmetic. On platforms with no hardware fma (or pre-compiled generic binaries), the fma form should be identical to the non-fma.