[Mesa-dev] [PATCH 16/56] glsl: Use _mesa_bitcount to implement constant ir_unop_bit_count
Ian Romanick
idr at freedesktop.org
Tue Jul 19 19:24:35 UTC 2016
From: Ian Romanick <ian.d.romanick at intel.com>
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/compiler/glsl/ir_constant_expression.cpp | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/src/compiler/glsl/ir_constant_expression.cpp b/src/compiler/glsl/ir_constant_expression.cpp
index 694c9c7..04b5877 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:
--
2.5.5
More information about the mesa-dev
mailing list