* below.
*/
+#include <stdint.h>
+
#define UF11(e, m) ((e << 6) | (m))
#define UF11_EXPONENT_BIAS 15
#define UF11_EXPONENT_BITS 0x1F
#define F32_INFINITY 0x7f800000
-static inline unsigned f32_to_uf11(float val)
+static inline uint32_t f32_to_uf11(float val)
{
union {
float f;
return f32.f;
}
-static inline unsigned f32_to_uf10(float val)
+static inline uint32_t f32_to_uf10(float val)
{
union {
float f;
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);
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;
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;