mesa: Allow setting GL_TEXTURE_MAX_LEVEL to 0 with GL_TEXTURE_RECTANGLE.
[mesa.git] / src / mesa / main / macros.h
index 880c6564e185b6384a5a6609dd32a29833ec01e6..dafeaa372f1c7ad7d6e5fbaadb787230127642a8 100644 (file)
@@ -193,7 +193,7 @@ static INLINE uint32_t
 U_FIXED(float value, uint32_t frac_bits)
 {
    value *= (1 << frac_bits);
-   return value < 0 ? 0 : value;
+   return value < 0.0f ? 0 : (uint32_t) value;
 }
 
 /**
@@ -201,10 +201,10 @@ U_FIXED(float value, uint32_t frac_bits)
  *
  * \param frac_bits   The number of bits used to store the fractional part.
  */
-static INLINE uint32_t
+static INLINE int32_t
 S_FIXED(float value, uint32_t frac_bits)
 {
-   return value * (1 << frac_bits);
+   return (int32_t) (value * (1 << frac_bits));
 }
 /*@}*/
 
@@ -809,5 +809,7 @@ DIFFERENT_SIGNS(GLfloat x, GLfloat y)
 /* Compute the size of an array */
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
 
+/* Stringify */
+#define STRINGIFY(x) #x
 
 #endif