glsl: Use _mesa_bitcount to implement constant ir_unop_bit_count
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
@@ -1500,15 +1500,8 @@ ir_expression::constant_expression_value(struct hash_table *variable_context)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ir_unop_bit_count:
|
case ir_unop_bit_count:
|
||||||
for (unsigned c = 0; c < components; c++) {
|
for (unsigned c = 0; c < components; c++)
|
||||||
unsigned count = 0;
|
data.i[c] = _mesa_bitcount(op[0]->value.u[c]);
|
||||||
unsigned v = op[0]->value.u[c];
|
|
||||||
|
|
||||||
for (; v; count++) {
|
|
||||||
v &= v - 1;
|
|
||||||
}
|
|
||||||
data.u[c] = count;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ir_unop_find_msb:
|
case ir_unop_find_msb:
|
||||||
|
Reference in New Issue
Block a user