mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
added FixedToDouble() macro
This commit is contained in:
parent
84b4a3a087
commit
c2f6d6d092
1 changed files with 4 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue