1 // Copyright 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
8 // CPU_COUNT is only provided by glibc 2.6 or higher
10 #define CPU_COUNT(set) _CPU_COUNT((unsigned int *)(set), sizeof(*(set))/sizeof(unsigned int))
11 static int _CPU_COUNT(unsigned int *set
, size_t len
) {
16 cnt
+= __builtin_popcount(*set
++);
31 r
= sched_getaffinity(0, sizeof(set
), &set
);
33 cnt
+= CPU_COUNT(&set
);