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>
This commit is contained in:
committed by
Marge Bot
parent
f1dc4c9554
commit
360ffdf4e2
+54
-16
@@ -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) )
|
||||
static inline GLboolean
|
||||
FLOAT_TO_BOOLEAN(GLfloat X)
|
||||
{
|
||||
return ( (X) ? GL_TRUE : GL_FALSE );
|
||||
}
|
||||
|
||||
#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) )
|
||||
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) );
|
||||
}
|
||||
|
||||
#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))) )
|
||||
static inline GLboolean
|
||||
INT_TO_BOOLEAN(GLint I)
|
||||
{
|
||||
return ( (I) ? GL_TRUE : GL_FALSE );
|
||||
}
|
||||
|
||||
#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 )
|
||||
static inline GLfixed
|
||||
INT_TO_FIXED(GLint I)
|
||||
{
|
||||
return (((I) > SHRT_MAX) ? INT_MAX :
|
||||
((I) < SHRT_MIN) ? INT_MIN :
|
||||
(GLint) ((I) * 65536) );
|
||||
}
|
||||
|
||||
#define ENUM_TO_INT64(E) ( (GLint64) (E) )
|
||||
#define ENUM_TO_FIXED(E) (E)
|
||||
|
||||
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,
|
||||
|
||||
Reference in New Issue
Block a user