etnaviv: switch to log2f(..)
authorChristian Gmeiner <cgmeiner@igalia.com>
Thu, 27 Jul 2023 10:12:08 +0000 (12:12 +0200)
committerMarge Bot <emma+marge@anholt.net>
Mon, 14 Aug 2023 14:10:15 +0000 (14:10 +0000)
Drop our custom calculation of the logarithm base 2 and switch
to log2f(..).

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24364>

src/gallium/drivers/etnaviv/etnaviv_util.h

index 48b1e7d..5caf17e 100644 (file)
@@ -43,9 +43,6 @@ etna_cfloat_to_uint8(float f)
    return f * 256.0f;
 }
 
-/* 1/log10(2) */
-#define RCPLOG2 (1.4426950408889634f)
-
 /* float to fixp 5.5 */
 static inline uint32_t
 etna_float_to_fixp55(float f)
@@ -76,14 +73,14 @@ etna_float_to_fixp88(float f)
 static inline uint32_t
 etna_log2_fixp55(unsigned width)
 {
-   return etna_float_to_fixp55(logf((float)width) * RCPLOG2);
+   return etna_float_to_fixp55(log2f((float)width));
 }
 
 /* texture size to log2 in fixp 8.8 format */
 static inline uint32_t
 etna_log2_fixp88(unsigned width)
 {
-   return etna_float_to_fixp88(logf((float)width) * RCPLOG2);
+   return etna_float_to_fixp88(log2f((float)width));
 }
 
 /* float to fixp 16.16 */