aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristian H. Kristensen <[email protected]>2020-02-18 14:41:38 -0800
committerMarge Bot <[email protected]>2020-02-19 18:34:33 +0000
commit360ffdf4e23464879748051e57587aff938bd50d (patch)
treeb9ee8b22506f1c2209a038924606501c72012926
parentf1dc4c9554ce913acf4d3236b4d43b829fb92073 (diff)
main/get: Converted type conversion macros to inline functions
Quiet warnings when called with a GLubyte: src/mesa/main/get.c:3215:19: warning: result of comparison of constant 32767 with expression of type 'GLubyte' (aka 'unsigned char') is always false [-Wtautological-constant-out-of-range-compare] params[0] = INT_TO_FIXED(((GLubyte *) p)[0]); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/mesa/main/get.c:78:38: note: expanded from macro 'INT_TO_FIXED' ~~~ ^ ~~~~~~~~ Delete ENUM_TO_INT64, ENUM_TO_FIXED and BOOLEAN_TO_INT64 which aren't used. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3866>
-rw-r--r--src/mesa/main/get.c78
1 files changed, 58 insertions, 20 deletions
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 765c0e4ae2c..261eaf37323 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -69,26 +69,64 @@
* is about as concise as the specification in the old python script.
*/
-#define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE )
-#define FLOAT_TO_FIXED(F) ( ((F) * 65536.0f > INT_MAX) ? INT_MAX : \
- ((F) * 65536.0f < INT_MIN) ? INT_MIN : \
- (GLint) ((F) * 65536.0f) )
-
-#define INT_TO_BOOLEAN(I) ( (I) ? GL_TRUE : GL_FALSE )
-#define INT_TO_FIXED(I) ( ((I) > SHRT_MAX) ? INT_MAX : \
- ((I) < SHRT_MIN) ? INT_MIN : \
- (GLint) ((I) * 65536) )
-
-#define INT64_TO_BOOLEAN(I) ( (I) ? GL_TRUE : GL_FALSE )
-#define INT64_TO_INT(I) ( (GLint)((I > INT_MAX) ? INT_MAX : ((I < INT_MIN) ? INT_MIN : (I))) )
-
-#define BOOLEAN_TO_INT(B) ( (GLint) (B) )
-#define BOOLEAN_TO_INT64(B) ( (GLint64) (B) )
-#define BOOLEAN_TO_FLOAT(B) ( (B) ? 1.0F : 0.0F )
-#define BOOLEAN_TO_FIXED(B) ( (GLint) ((B) ? 1 : 0) << 16 )
-
-#define ENUM_TO_INT64(E) ( (GLint64) (E) )
-#define ENUM_TO_FIXED(E) (E)
+static inline GLboolean
+FLOAT_TO_BOOLEAN(GLfloat X)
+{
+ return ( (X) ? GL_TRUE : GL_FALSE );
+}
+
+static inline GLint
+FLOAT_TO_FIXED(GLfloat F)
+{
+ return ( ((F) * 65536.0f > INT_MAX) ? INT_MAX :
+ ((F) * 65536.0f < INT_MIN) ? INT_MIN :
+ (GLint) ((F) * 65536.0f) );
+}
+
+static inline GLboolean
+INT_TO_BOOLEAN(GLint I)
+{
+ return ( (I) ? GL_TRUE : GL_FALSE );
+}
+
+static inline GLfixed
+INT_TO_FIXED(GLint I)
+{
+ return (((I) > SHRT_MAX) ? INT_MAX :
+ ((I) < SHRT_MIN) ? INT_MIN :
+ (GLint) ((I) * 65536) );
+}
+
+
+static inline GLboolean
+INT64_TO_BOOLEAN(GLint64 I)
+{
+ return ( (I) ? GL_TRUE : GL_FALSE );
+}
+
+static inline GLint
+INT64_TO_INT(GLint64 I)
+{
+ return ( (GLint)((I > INT_MAX) ? INT_MAX : ((I < INT_MIN) ? INT_MIN : (I))) );
+}
+
+static inline GLint
+BOOLEAN_TO_INT(GLboolean B)
+{
+ return ( (GLint) (B) );
+}
+
+static inline GLfloat
+BOOLEAN_TO_FLOAT(GLboolean B)
+{
+ return ( (B) ? 1.0F : 0.0F );
+}
+
+static inline GLfixed
+BOOLEAN_TO_FIXED(GLboolean B)
+{
+ return ( (GLint) ((B) ? 1 : 0) << 16 );
+}
enum value_type {
TYPE_INVALID,