summaryrefslogtreecommitdiff
path: root/xc/extras/Mesa/src/mmath.c
diff options
context:
space:
mode:
Diffstat (limited to 'xc/extras/Mesa/src/mmath.c')
-rw-r--r--xc/extras/Mesa/src/mmath.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/xc/extras/Mesa/src/mmath.c b/xc/extras/Mesa/src/mmath.c
index 06d134955..d93400d20 100644
--- a/xc/extras/Mesa/src/mmath.c
+++ b/xc/extras/Mesa/src/mmath.c
@@ -140,7 +140,8 @@ init_ubyte_color_tab(void)
/*
* Initialize tables, etc for fast math functions.
*/
-void _mesa_init_math(void)
+void
+_mesa_init_math(void)
{
static GLboolean initialized = GL_FALSE;
@@ -166,3 +167,21 @@ void _mesa_init_math(void)
#endif
}
}
+
+
+
+/*
+ * Return number of bits set in given GLuint.
+ */
+GLuint
+_mesa_bitcount(GLuint n)
+{
+ GLuint bits;
+ for (bits = 0; n > 0; n = n >> 1) {
+ if (n & 1) {
+ bits++;
+ }
+ }
+ return bits;
+}
+