Commit 2011fd9a authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

vlc_GetCPUCount: use counting functions instead of loop

parent 497f9aff
......@@ -1038,10 +1038,7 @@ unsigned vlc_GetCPUCount(void)
if (sched_getaffinity (getpid(), sizeof (cpu), &cpu) < 0)
return 1;
unsigned count = 0;
for (unsigned i = 0; i < CPU_SETSIZE; i++)
count += CPU_ISSET(i, &cpu) != 0;
return count;
return CPU_COUNT (&cpu);
#elif defined(__APPLE__)
int count;
......
......@@ -916,15 +916,7 @@ unsigned vlc_GetCPUCount (void)
DWORD system;
if (GetProcessAffinityMask (GetCurrentProcess(), &process, &system))
{
unsigned count = 0;
while (system)
{
count++;
system >>= 1;
}
return count;
}
return popcount (system);
#endif
return 1;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment