projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
53d5075
)
gallium: added util_is_inf_or_nan() function to u_math.h
author
Brian Paul
<brianp@vmware.com>
Tue, 31 Mar 2009 22:06:19 +0000
(16:06 -0600)
committer
Brian Paul
<brianp@vmware.com>
Tue, 31 Mar 2009 22:21:51 +0000
(16:21 -0600)
src/gallium/auxiliary/util/u_math.h
patch
|
blob
|
history
diff --git
a/src/gallium/auxiliary/util/u_math.h
b/src/gallium/auxiliary/util/u_math.h
index 9268a9bb7eea3eafda57130f44181742ebe6d99d..e5003af01d89fa35191ba8f157a607f6e87bd548 100644
(file)
--- a/
src/gallium/auxiliary/util/u_math.h
+++ b/
src/gallium/auxiliary/util/u_math.h
@@
-319,6
+319,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.