util: Fix util_fast_pow/exp2/log2.
authorBrian <brian.paul@tungstengraphics.com>
Sun, 9 Nov 2008 17:15:32 +0000 (10:15 -0700)
committerBrian <brian.paul@tungstengraphics.com>
Sun, 9 Nov 2008 17:17:43 +0000 (10:17 -0700)
commit325cbeb29a63e3d71da00baeab864970fe3aa595
treec7a63e26acb56b146dfb0c66995b19fff30a656a
parent7e8315701945ec807b2b5a9d01250b5ab74ae183
util: Fix util_fast_pow/exp2/log2.

- Use a lookup table for log2.

- Compute (float) (1 << ipart) by tweaking with the exponent directly to
avoid integer overflow and float conversion.

- Also table negative exponents to avoid float division and branching.

- Implement util_fast_exp as function of util_fast_exp2.

--------

Cherry-picked from gallium-0.2: 8415d06d90a197e16554dab98d160334fd9f9f93

This fixes some pow() glitches seen in fslight.c, spectex.c, etc.

Conflicts:
       src/gallium/auxiliary/util/u_math.h
src/gallium/auxiliary/util/u_math.c
src/gallium/auxiliary/util/u_math.h