summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2012-09-14 16:04:40 -0700
committerMatt Turner <[email protected]>2012-09-24 09:45:17 -0700
commit0f3ba405eada72e1ab4371948315b28608903927 (patch)
tree602b87722ca0ce80b78559d2f48e97bbed4b6851 /src
parent959fe586fb0d64642facffff8c0132777523ed42 (diff)
Use signbit() in IS_NEGATIVE and DIFFERENT_SIGNS
signbit() appears to be available everywhere (even MSVC according to MSDN), so let's use it instead of open-coding some messy and confusing bit twiddling macros. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54805 Reviewed-by: Paul Berry <[email protected]> Suggested-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/macros.h21
1 files changed, 2 insertions, 19 deletions
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index 04d59d79c07..7b7fd1b6d76 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -693,31 +693,14 @@ NORMALIZE_3FV(GLfloat v[3])
static inline GLboolean
IS_NEGATIVE(float x)
{
-#if defined(USE_IEEE)
- fi_type fi;
- fi.f = x;
- return fi.i < 0;
-#else
- return x < 0.0F;
-#endif
+ return signbit(x) != 0;
}
-
/** Test two floats have opposite signs */
static inline GLboolean
DIFFERENT_SIGNS(GLfloat x, GLfloat y)
{
-#if defined(USE_IEEE)
- fi_type xfi, yfi;
- xfi.f = x;
- yfi.f = y;
- return !!((xfi.i ^ yfi.i) & (1u << 31));
-#else
- /* Could just use (x*y<0) except for the flatshading requirements.
- * Maybe there's a better way?
- */
- return ((x) * (y) <= 0.0F && (x) - (y) != 0.0F);
-#endif
+ return signbit(x) != signbit(y);
}