summaryrefslogtreecommitdiff
path: root/src/mesa/main/macros.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main/macros.h')
-rw-r--r--src/mesa/main/macros.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index 03a228b4474..8b09e7b20e9 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -194,6 +194,20 @@ static inline fi_type FLOAT_AS_UNION(GLfloat f)
return tmp;
}
+static inline uint64_t DOUBLE_AS_UINT64(double d)
+{
+ union {
+ double d;
+ uint64_t u64;
+ } tmp;
+ tmp.d = d;
+ return tmp.u64;
+}
+
+/* First sign-extend x, then return uint32_t. */
+#define INT_AS_UINT(x) ((uint32_t)((int32_t)(x)))
+#define FLOAT_AS_UINT(x) (FLOAT_AS_UNION(x).u)
+
/**
* Convert a floating point value to an unsigned fixed point value.
*