summaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2016-08-03 09:58:13 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2016-08-05 09:07:04 -0700
commitffcf8e1049f300b3a890bdd1ce778c8436aee049 (patch)
treea875995d71184aebd6d74192177a12a6f6a07f1e /src/util
parentc7eb9a75653c1df54e6c36873c8c4ddd142b98d6 (diff)
downloadexternal_mesa3d-ffcf8e1049f300b3a890bdd1ce778c8436aee049.zip
external_mesa3d-ffcf8e1049f300b3a890bdd1ce778c8436aee049.tar.gz
external_mesa3d-ffcf8e1049f300b3a890bdd1ce778c8436aee049.tar.bz2
util/format: Use explicitly sized types
Both the rgb9e5 and r11g11b10 formats are defined based on how they are packed into a 32-bit integer. It makes sense that the functions that manipulate them take an explicitly sized type. Signed-off-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Diffstat (limited to 'src/util')
-rw-r--r--src/util/format_r11g11b10f.h10
-rw-r--r--src/util/format_rgb9e5.h4
2 files changed, 8 insertions, 6 deletions
diff --git a/src/util/format_r11g11b10f.h b/src/util/format_r11g11b10f.h
index 218822b..5fe2e51 100644
--- a/src/util/format_r11g11b10f.h
+++ b/src/util/format_r11g11b10f.h
@@ -27,6 +27,8 @@
* below.
*/
+#include <stdint.h>
+
#define UF11(e, m) ((e << 6) | (m))
#define UF11_EXPONENT_BIAS 15
#define UF11_EXPONENT_BITS 0x1F
@@ -45,7 +47,7 @@
#define F32_INFINITY 0x7f800000
-static inline unsigned f32_to_uf11(float val)
+static inline uint32_t f32_to_uf11(float val)
{
union {
float f;
@@ -131,7 +133,7 @@ static inline float uf11_to_f32(uint16_t val)
return f32.f;
}
-static inline unsigned f32_to_uf10(float val)
+static inline uint32_t f32_to_uf10(float val)
{
union {
float f;
@@ -217,14 +219,14 @@ static inline float uf10_to_f32(uint16_t val)
return f32.f;
}
-static inline unsigned float3_to_r11g11b10f(const float rgb[3])
+static inline uint32_t float3_to_r11g11b10f(const float rgb[3])
{
return ( f32_to_uf11(rgb[0]) & 0x7ff) |
((f32_to_uf11(rgb[1]) & 0x7ff) << 11) |
((f32_to_uf10(rgb[2]) & 0x3ff) << 22);
}
-static inline void r11g11b10f_to_float3(unsigned rgb, float retval[3])
+static inline void r11g11b10f_to_float3(uint32_t rgb, float retval[3])
{
retval[0] = uf11_to_f32( rgb & 0x7ff);
retval[1] = uf11_to_f32((rgb >> 11) & 0x7ff);
diff --git a/src/util/format_rgb9e5.h b/src/util/format_rgb9e5.h
index 2559e1e..70ad04f 100644
--- a/src/util/format_rgb9e5.h
+++ b/src/util/format_rgb9e5.h
@@ -57,7 +57,7 @@ static inline int rgb9e5_ClampRange(float x)
return f.u;
}
-static inline unsigned int float3_to_rgb9e5(const float rgb[3])
+static inline uint32_t float3_to_rgb9e5(const float rgb[3])
{
int rm, gm, bm, exp_shared;
uint32_t revdenom_biasedexp;
@@ -104,7 +104,7 @@ static inline unsigned int float3_to_rgb9e5(const float rgb[3])
return (exp_shared << 27) | (bm << 18) | (gm << 9) | rm;
}
-static inline void rgb9e5_to_float3(unsigned rgb, float retval[3])
+static inline void rgb9e5_to_float3(uint32_t rgb, float retval[3])
{
int exponent;
union { float f; uint32_t u; } scale;