summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl/ir_constant_expression.cpp
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2016-07-11 11:20:02 -0700
committerIan Romanick <[email protected]>2016-08-30 16:28:00 -0700
commit4b0606e0a7c3260e761137246923f453dcf1efe1 (patch)
treeaeb27dd18ae9a22af8dd67c5203054a11b33b477 /src/compiler/glsl/ir_constant_expression.cpp
parentf4af9f36e724a7f8b17c41508a0f8cd37470678b (diff)
glsl: Use _mesa_bitcount to implement constant ir_unop_bit_count
Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/compiler/glsl/ir_constant_expression.cpp')
-rw-r--r--src/compiler/glsl/ir_constant_expression.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/compiler/glsl/ir_constant_expression.cpp b/src/compiler/glsl/ir_constant_expression.cpp
index 2664fefbc45..01a7224f470 100644
--- a/src/compiler/glsl/ir_constant_expression.cpp
+++ b/src/compiler/glsl/ir_constant_expression.cpp
@@ -1500,15 +1500,8 @@ ir_expression::constant_expression_value(struct hash_table *variable_context)
break;
case ir_unop_bit_count:
- for (unsigned c = 0; c < components; c++) {
- unsigned count = 0;
- unsigned v = op[0]->value.u[c];
-
- for (; v; count++) {
- v &= v - 1;
- }
- data.u[c] = count;
- }
+ for (unsigned c = 0; c < components; c++)
+ data.i[c] = _mesa_bitcount(op[0]->value.u[c]);
break;
case ir_unop_find_msb: