diff options
author | marha <marha@users.sourceforge.net> | 2010-04-12 09:53:17 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2010-04-12 09:53:17 +0000 |
commit | 29b86f9852b2b7ecc31cdfee56679537e40bc6e2 (patch) | |
tree | 1e6ec8ccf2dbf773260a1953b8e13c49f9b7c5f5 /mesalib/src/mesa/main/macros.h | |
parent | 529236591df7366479a6fac30b387667678fd1ba (diff) | |
download | vcxsrv-29b86f9852b2b7ecc31cdfee56679537e40bc6e2.tar.gz vcxsrv-29b86f9852b2b7ecc31cdfee56679537e40bc6e2.tar.bz2 vcxsrv-29b86f9852b2b7ecc31cdfee56679537e40bc6e2.zip |
svn merge -r524:HEAD "^/branches/released" .
Diffstat (limited to 'mesalib/src/mesa/main/macros.h')
-rw-r--r-- | mesalib/src/mesa/main/macros.h | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/mesalib/src/mesa/main/macros.h b/mesalib/src/mesa/main/macros.h index 3d9a1aba9..a8624574d 100644 --- a/mesalib/src/mesa/main/macros.h +++ b/mesalib/src/mesa/main/macros.h @@ -83,14 +83,14 @@ extern GLfloat _mesa_ubyte_to_float_color_tab[256]; /** Convert GLuint in [0,4294967295] to GLfloat in [0.0,1.0] */ -#define UINT_TO_FLOAT(U) ((GLfloat) (U) * (1.0F / 4294967295.0)) +#define UINT_TO_FLOAT(U) ((GLfloat) ((U) * (1.0F / 4294967295.0))) /** Convert GLfloat in [0.0,1.0] to GLuint in [0,4294967295] */ #define FLOAT_TO_UINT(X) ((GLuint) ((X) * 4294967295.0)) /** Convert GLint in [-2147483648,2147483647] to GLfloat in [-1.0,1.0] */ -#define INT_TO_FLOAT(I) ((2.0F * (I) + 1.0F) * (1.0F/4294967294.0)) +#define INT_TO_FLOAT(I) ((GLfloat) ((2.0F * (I) + 1.0F) * (1.0F/4294967294.0))) /** Convert GLfloat in [-1.0,1.0] to GLint in [-2147483648,2147483647] */ /* causes overflow: @@ -202,17 +202,12 @@ do { \ #endif /** - * Copy a 4-element float vector (avoid using FPU registers) - * XXX Could use two 64-bit moves on 64-bit systems + * Copy a 4-element float vector + * memcpy seems to be most efficient */ #define COPY_4FV( DST, SRC ) \ do { \ - const GLuint *_s = (const GLuint *) (SRC); \ - GLuint *_d = (GLuint *) (DST); \ - _d[0] = _s[0]; \ - _d[1] = _s[1]; \ - _d[2] = _s[2]; \ - _d[3] = _s[3]; \ + memcpy(DST, SRC, sizeof(GLfloat) * 4); \ } while (0) /** Copy \p SZ elements into a 4-element vector */ @@ -631,12 +626,6 @@ do { \ /** Clamp X to [MIN,MAX] */ #define CLAMP( X, MIN, MAX ) ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) ) -/** Assign X to CLAMP(X, MIN, MAX) */ -#define CLAMP_SELF(x, mn, mx) \ - ( (x)<(mn) ? ((x) = (mn)) : ((x)>(mx) ? ((x)=(mx)) : (x)) ) - - - /** Minimum of two values: */ #define MIN2( A, B ) ( (A)<(B) ? (A) : (B) ) |