summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2004-02-17 04:24:52 +0000
committerBrian Paul <[email protected]>2004-02-17 04:24:52 +0000
commitc2f6d6d092cb769416af453a9b8e216b20747bec (patch)
tree5783e10cc525d46c7d94da21bbfed5d26bf1eeb5 /src/mesa/main
parent84b4a3a087a1475d4e9bd713e4bae91ba6363a50 (diff)
added FixedToDouble() macro
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/mtypes.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 37fb9a24081..a8f0edba8b6 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -108,7 +108,9 @@ typedef int GLfixed;
/*
* Fixed point arithmetic macros
*/
+#ifndef FIXED_FRAC_BITS
#define FIXED_FRAC_BITS 11
+#endif
#define FIXED_SHIFT FIXED_FRAC_BITS
#define FIXED_ONE (1 << FIXED_SHIFT)
@@ -117,7 +119,9 @@ typedef int GLfixed;
#define FIXED_INT_MASK (~FIXED_FRAC_MASK)
#define FIXED_EPSILON 1
#define FIXED_SCALE ((float) FIXED_ONE)
+#define FIXED_DBL_SCALE ((double) FIXED_ONE)
#define FloatToFixed(X) (IROUND((X) * FIXED_SCALE))
+#define FixedToDouble(X) ((X) * (1.0 / FIXED_DBL_SCALE))
#define IntToFixed(I) ((I) << FIXED_SHIFT)
#define FixedToInt(X) ((X) >> FIXED_SHIFT)
#define FixedToUns(X) (((unsigned int)(X)) >> FIXED_SHIFT)