summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util/u_math.h
diff options
context:
space:
mode:
authorKeith Whitwell <[email protected]>2009-09-23 17:37:28 +0100
committerKeith Whitwell <[email protected]>2009-09-23 17:37:28 +0100
commit890679d4322e7ba4f12f32532a3fdd277edff886 (patch)
tree37df5e8a53f7da9fdcaf2e9660c694e28e14b5bc /src/gallium/auxiliary/util/u_math.h
parenta1fa770c01d913658900de1c267fb4c41bc6300d (diff)
parent75276ea316610a5737f2115326482024aa09d02a (diff)
Merge branch 'softpipe-opt'
Conflicts: progs/demos/cubemap.c src/gallium/drivers/softpipe/sp_tex_sample.c src/gallium/drivers/softpipe/sp_texture.c
Diffstat (limited to 'src/gallium/auxiliary/util/u_math.h')
-rw-r--r--src/gallium/auxiliary/util/u_math.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
index b428dc544c3..cd6a9fcc091 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -283,6 +283,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;
+}
+
/**
* Floor(x), returned as int.