diff options
author | Brian Paul <brianp@vmware.com> | 2009-03-31 16:06:19 -0600 |
---|---|---|
committer | Brian Paul <brianp@vmware.com> | 2009-03-31 16:21:51 -0600 |
commit | 3705d03b0fbe349dee0221d982965a0590bc7cb0 (patch) | |
tree | fd88d1be92fa895e246c7124fd319977004a246d /src/gallium | |
parent | 53d507562b252718d95fd99812f5d21c9ae79713 (diff) |
gallium: added util_is_inf_or_nan() function to u_math.h
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/auxiliary/util/u_math.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index 9268a9bb7e..e5003af01d 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -320,6 +320,18 @@ util_iround(float f) /** + * Test if x is NaN or +/- infinity. + */ +static INLINE boolean +util_is_inf_or_nan(float x) +{ + union fi tmp; + tmp.f = x; + return !(int)((unsigned int)((tmp.i & 0x7fffffff)-0x7f800000) >> 31); +} + + +/** * Find first bit set in word. Least significant bit is 1. * Return 0 if no bits set. */ |