aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/macros.h
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-09-03 09:54:39 +0200
committermarha <marha@users.sourceforge.net>2012-09-03 09:54:39 +0200
commitb86e8562b1ddca2a8bc29f22a79451a041bf5293 (patch)
tree60fead0638fce6922b4043767fa991ff1f0e3488 /mesalib/src/mesa/main/macros.h
parent53192e17e55aa9ed3e3721bf4fdcb2b01a595202 (diff)
downloadvcxsrv-b86e8562b1ddca2a8bc29f22a79451a041bf5293.tar.gz
vcxsrv-b86e8562b1ddca2a8bc29f22a79451a041bf5293.tar.bz2
vcxsrv-b86e8562b1ddca2a8bc29f22a79451a041bf5293.zip
mesa xkeyboard-config git update 3 sep 2012
Diffstat (limited to 'mesalib/src/mesa/main/macros.h')
-rw-r--r--mesalib/src/mesa/main/macros.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/mesalib/src/mesa/main/macros.h b/mesalib/src/mesa/main/macros.h
index 5af9487cb..7d0a375d1 100644
--- a/mesalib/src/mesa/main/macros.h
+++ b/mesalib/src/mesa/main/macros.h
@@ -689,6 +689,38 @@ NORMALIZE_3FV(GLfloat v[3])
}
+/** Is float value negative? */
+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
+}
+
+
+/** 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
+}
+
+
/** Compute ceiling of integer quotient of A divided by B. */
#define CEILING( A, B ) ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 )