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) ...@@ -1038,10 +1038,7 @@ unsigned vlc_GetCPUCount(void)
if (sched_getaffinity (getpid(), sizeof (cpu), &cpu) < 0) if (sched_getaffinity (getpid(), sizeof (cpu), &cpu) < 0)
return 1; return 1;
unsigned count = 0; return CPU_COUNT (&cpu);
for (unsigned i = 0; i < CPU_SETSIZE; i++)
count += CPU_ISSET(i, &cpu) != 0;
return count;
#elif defined(__APPLE__) #elif defined(__APPLE__)
int count; int count;
......
...@@ -916,15 +916,7 @@ unsigned vlc_GetCPUCount (void) ...@@ -916,15 +916,7 @@ unsigned vlc_GetCPUCount (void)
DWORD system; DWORD system;
if (GetProcessAffinityMask (GetCurrentProcess(), &process, &system)) if (GetProcessAffinityMask (GetCurrentProcess(), &process, &system))
{ return popcount (system);
unsigned count = 0;
while (system)
{
count++;
system >>= 1;
}
return count;
}
#endif #endif
return 1; 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