diff options
author | Marek Olšák <marek.olsak@amd.com> | 2020-09-18 05:48:05 -0400 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2020-09-30 16:28:24 +0000 |
commit | 5af81393e419eaf086e4de2a1d149af78cd1f54d (patch) | |
tree | 8d008488577182e9cd4fb02c2542dd71b22ba66c /src/gallium/auxiliary/util | |
parent | 87900afe5bbe90c5f3ad0921b28ae1c889029ada (diff) |
util: move util_half_to_float code into _mesa_half_to_float_slow
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6774>
Diffstat (limited to 'src/gallium/auxiliary/util')
-rw-r--r-- | src/gallium/auxiliary/util/u_half.h | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/src/gallium/auxiliary/util/u_half.h b/src/gallium/auxiliary/util/u_half.h index bbcc843c310..04c59302765 100644 --- a/src/gallium/auxiliary/util/u_half.h +++ b/src/gallium/auxiliary/util/u_half.h @@ -110,29 +110,7 @@ util_float_to_half_rtz(float f) static inline float util_half_to_float(uint16_t f16) { - union fi infnan; - union fi magic; - union fi f32; - - infnan.ui = 0x8f << 23; - infnan.f = 65536.0f; - magic.ui = 0xef << 23; - - /* Exponent / Mantissa */ - f32.ui = (f16 & 0x7fff) << 13; - - /* Adjust */ - f32.f *= magic.f; - /* XXX: The magic mul relies on denorms being available */ - - /* Inf / NaN */ - if (f32.f >= infnan.f) - f32.ui |= 0xff << 23; - - /* Sign */ - f32.ui |= (uint32_t)(f16 & 0x8000) << 16; - - return f32.f; + return _mesa_half_to_float(f16); } #ifdef __cplusplus |