[vorbis-dev] Another good optimization (for PPC only, though)

Segher Boessenkool segher at wanadoo.nl
Mon Nov 27 07:27:11 PST 2000



> // Vanilla PPC code, but since PPC has a reciprocal square root estimate instruction,
> // runs *much* faster than calling sqrt().  We'll use two Newton-Raphson
> // refinement steps to get bunch more precision in the 1/sqrt() value for very little cost.
> // We'll then invert using the PPC reciprocal estimate instruction and also refine that
> // (although we should only need a single refinement step there).

Nonononono! If you got y = 1/sqrt(x), then "y *= x;" will give you y = sqrt(x),
easier, cheaper & better :-)

>     if (x == 0.0)

There are separate +0.0 and -0.0, so you better watch out.

>     /* Second refinement step */
>     y0 = y1;
>     y1 = y0 + half*y0*(one - B*y0*y0);

Why the copying?

Ciao,

Segher

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis-dev mailing list