util/test: Use MAX_PATH on Windows
[mesa.git] / src / util / format_r11g11b10f.h
index 5fe2e510d223cc22bc61600c8e1fc132d21a3d62..ec5abf96119353c355bbe48167897e5ccb4ba7e6 100644 (file)
@@ -27,6 +27,9 @@
  * below.
  */
 
+#ifndef FORMAT_R11G11B10F_H
+#define FORMAT_R11G11B10F_H
+
 #include <stdint.h>
 
 #define UF11(e, m)           ((e << 6) | (m))
@@ -86,8 +89,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 +115,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 +171,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 +194,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) {
@@ -232,3 +228,5 @@ static inline void r11g11b10f_to_float3(uint32_t rgb, float retval[3])
    retval[1] = uf11_to_f32((rgb >> 11) & 0x7ff);
    retval[2] = uf10_to_f32((rgb >> 22) & 0x3ff);
 }
+
+#endif /* FORMAT_R11G11B10F_H */