diff options
author | Daniel Borca <[email protected]> | 2005-01-11 10:56:39 +0000 |
---|---|---|
committer | Daniel Borca <[email protected]> | 2005-01-11 10:56:39 +0000 |
commit | 94dd520210293750ab6f3094a6a8c67e23f61ef2 (patch) | |
tree | 420564deec5b3052ab4a43009f0c23a6b1f58e37 /src/mesa | |
parent | 5358682aa7b8d495c45991fcd750250883e78444 (diff) |
applied Keith's patch for "safe" type-punning.
made IS_NEGATIVE produce a boolean (useful when xoring with other booleans).
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/imports.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index b69b5fa31a1..5158bcd8b25 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -340,8 +340,13 @@ static INLINE int IS_INF_OR_NAN( float x ) *** IS_NEGATIVE: test if float is negative ***/ #if defined(USE_IEEE) -#define GET_FLOAT_BITS(x) ((fi_type *) &(x))->i -#define IS_NEGATIVE(x) (GET_FLOAT_BITS(x) & (1<<31)) +static INLINE int GET_FLOAT_BITS( float x ) +{ + fi_type fi; + fi.f = x; + return fi.i; +} +#define IS_NEGATIVE(x) (GET_FLOAT_BITS(x) < 0) #else #define IS_NEGATIVE(x) (x < 0.0F) #endif @@ -567,14 +572,9 @@ static INLINE int iceil(float f) /*** - *** COPY_FLOAT: copy a float from src to dest, avoid slow FP regs if possible + *** COPY_FLOAT: copy a float from src to dest. ***/ -#if defined(USE_IEEE) && !defined(DEBUG) -#define COPY_FLOAT( dst, src ) \ - ((fi_type *) &(dst))->i = ((fi_type *) (void *) &(src))->i -#else #define COPY_FLOAT( dst, src ) (dst) = (src) -#endif /*** |