mesa/main: use BITSET_FOREACH_SET in perf_monitor_result_size
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Sat, 12 Dec 2015 20:20:33 +0000 (15:20 -0500)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Tue, 15 Dec 2015 16:23:40 +0000 (11:23 -0500)
This should make the code both faster and slightly clearer.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/mesa/main/performance_monitor.c

index 98dfbea083cde2141070ffbe6e7c2d44ec4e395d..43529b2b35a3c350c1b8acfb7e6402f7d4381a52 100644 (file)
@@ -591,11 +591,10 @@ perf_monitor_result_size(const struct gl_context *ctx,
 
    for (group = 0; group < ctx->PerfMonitor.NumGroups; group++) {
       const struct gl_perf_monitor_group *g = &ctx->PerfMonitor.Groups[group];
-      for (counter = 0; counter < g->NumCounters; counter++) {
-         const struct gl_perf_monitor_counter *c = &g->Counters[counter];
+      BITSET_WORD tmp;
 
-         if (!BITSET_TEST(m->ActiveCounters[group], counter))
-            continue;
+      BITSET_FOREACH_SET(counter, tmp, m->ActiveCounters[group], g->NumCounters) {
+         const struct gl_perf_monitor_counter *c = &g->Counters[counter];
 
          size += sizeof(uint32_t); /* Group ID */
          size += sizeof(uint32_t); /* Counter ID */