From: Ian Romanick Date: Mon, 11 Jul 2016 18:20:02 +0000 (-0700) Subject: glsl: Use _mesa_bitcount to implement constant ir_unop_bit_count X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4b0606e0a7c3260e761137246923f453dcf1efe1;p=mesa.git glsl: Use _mesa_bitcount to implement constant ir_unop_bit_count Signed-off-by: Ian Romanick Reviewed-by: Matt Turner --- 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: