diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-12-20 21:47:56 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-12-20 21:48:09 -0800 |
commit | 67ab447959b62454f4e0273177baa19711babb96 (patch) | |
tree | f0a0a7c4bdad446a6311d65d18d19a2e534db81a /Graphics.c | |
parent | 1c2b70d13c42f5461a2d7c3cae7adf8d9b2e3cea (diff) |
Use lrint() from math library if available
Moves -lm from being hardcoded in Makefile.am to being added via
AC_SEARCH_LIBS in configure.ac setting it in $(MATH_LIBS)
Using lrint() [returns long int] instead of rint() [returns double]
clears a bunch of gcc warnings of the form:
"cast from function call of type ‘double’ to non-matching type ‘short int’"
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'Graphics.c')
-rw-r--r-- | Graphics.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -30,6 +30,10 @@ from The Open Group. * Author: Davor Matic, MIT X Consortium */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include <X11/IntrinsicP.h> #include <X11/StringDefs.h> #include <X11/Xfuncs.h> @@ -46,7 +50,11 @@ from The Open Group. #define min(x, y) (((int)(x) < (int)(y)) ? (x) : (y)) #define max(x, y) (((int)(x) > (int)(y)) ? (x) : (y)) #ifndef rint -#define rint(x) floor(x + 0.5) +# if HAVE_LRINT +# define rint(x) lrint(x) +# else +# define rint(x) floor(x + 0.5) +# endif #endif /*****************************************************************************\ |