X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Futil%2Fformat_r11g11b10f.h;h=f6cd4ac696a1e920568c0bd918fbcbe0010c235a;hb=c057278c065747c1f53579504bf109cafb7cb390;hp=5fe2e510d223cc22bc61600c8e1fc132d21a3d62;hpb=ffcf8e1049f300b3a890bdd1ce778c8436aee049;p=mesa.git diff --git a/src/util/format_r11g11b10f.h b/src/util/format_r11g11b10f.h index 5fe2e510d22..f6cd4ac696a 100644 --- a/src/util/format_r11g11b10f.h +++ b/src/util/format_r11g11b10f.h @@ -86,8 +86,7 @@ static inline uint32_t f32_to_uf11(float val) * converted to 65024." */ uf11 = UF11(30, 63); - } - else if (exponent > -15) { /* Representable value */ + } else if (exponent > -15) { /* Representable value */ exponent += UF11_EXPONENT_BIAS; mantissa >>= UF11_MANTISSA_SHIFT; uf11 = exponent << UF11_EXPONENT_SHIFT | mantissa; @@ -113,17 +112,14 @@ static inline float uf11_to_f32(uint16_t val) const float scale = 1.0 / (1 << 20); f32.f = scale * mantissa; } - } - else if (exponent == 31) { + } else if (exponent == 31) { f32.ui = F32_INFINITY | mantissa; - } - else { + } else { float scale, decimal; exponent -= 15; if (exponent < 0) { scale = 1.0f / (1 << -exponent); - } - else { + } else { scale = (float) (1 << exponent); } decimal = 1.0f + (float) mantissa / 64; @@ -172,8 +168,7 @@ static inline uint32_t f32_to_uf10(float val) * converted to 64512." */ uf10 = UF10(30, 31); - } - else if (exponent > -15) { /* Representable value */ + } else if (exponent > -15) { /* Representable value */ exponent += UF10_EXPONENT_BIAS; mantissa >>= UF10_MANTISSA_SHIFT; uf10 = exponent << UF10_EXPONENT_SHIFT | mantissa; @@ -196,14 +191,12 @@ static inline float uf10_to_f32(uint16_t val) if (exponent == 0) { if (mantissa != 0) { - const float scale = 1.0 / (1 << 20); + const float scale = 1.0 / (1 << 19); f32.f = scale * mantissa; } - } - else if (exponent == 31) { + } else if (exponent == 31) { f32.ui = F32_INFINITY | mantissa; - } - else { + } else { float scale, decimal; exponent -= 15; if (exponent < 0) {