u_format: Fix bitshifting for unpacking from 10F.
authorEric Anholt <eric@anholt.net>
Tue, 25 Oct 2011 23:53:00 +0000 (16:53 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 28 Oct 2011 19:10:01 +0000 (12:10 -0700)
This code was copy and pasted from the 11F unpacking, but not updated
for actually being 10 bits instead of 11.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41206
Reviewed-by: Marek Ol ák <maraeo@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/gallium/auxiliary/util/u_format_r11g11b10f.h

index b1946f8a3d800af0e156e86f21b0f5533a753e9f..5c05b7953cc127bc0518a4d2d4c99e65c2490e9e 100644 (file)
@@ -153,8 +153,8 @@ static INLINE float uf10_to_f32(uint16_t val)
       uint32_t ui;
    } f32;
 
-   int exponent = (val & 0x07c0) >> UF10_EXPONENT_SHIFT;
-   int mantissa = (val & 0x003f);
+   int exponent = (val & 0x03e0) >> UF10_EXPONENT_SHIFT;
+   int mantissa = (val & 0x001f);
 
    f32.f = 0.0;