projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
00c8359
)
util: add util_is_power_of_two function
author
Keith Whitwell
<keithw@vmware.com>
Fri, 21 Aug 2009 17:07:35 +0000
(18:07 +0100)
committer
Keith Whitwell
<keithw@vmware.com>
Fri, 21 Aug 2009 17:07:35 +0000
(18:07 +0100)
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 d30fa3c2d590af929a38ef0d815aae3eabf3ae9d..163522d3ef870bc41e82cc6f0eedcf492f1e61a9 100644
(file)
--- a/
src/gallium/auxiliary/util/u_math.h
+++ b/
src/gallium/auxiliary/util/u_math.h
@@
-273,6
+273,14
@@
util_fast_pow(float x, float y)
return util_fast_exp2(util_fast_log2(x) * y);
}
+/* Note that this counts zero as a power of two.
+ */
+static INLINE boolean
+util_is_power_of_two( unsigned v )
+{
+ return (v & (v-1)) == 0;
+}
+
/**