Merge commit 'origin/master' into i965g-restart
[mesa.git] / src / gallium / auxiliary / util / u_math.h
index a5cd6574c0ec6c0abb49926932b061f41eb1f06f..3bc527f5b291ab46d0c02b5561061577979dd39a 100644 (file)
@@ -583,6 +583,19 @@ do {                                     \
 #endif
 
 
+static INLINE uint32_t util_unsigned_fixed(float value, unsigned frac_bits)
+{
+   value *= (1<<frac_bits);
+   return value < 0 ? 0 : value;
+}
+
+static INLINE int32_t util_signed_fixed(float value, unsigned frac_bits)
+{
+   return value * (1<<frac_bits);
+}
+
+
+
 #ifdef __cplusplus
 }
 #endif