From: Brian Paul Date: Tue, 17 Feb 2004 04:24:52 +0000 (+0000) Subject: added FixedToDouble() macro X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c2f6d6d092cb769416af453a9b8e216b20747bec;p=mesa.git added FixedToDouble() macro --- 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)