Commit b1923f4d authored by Jim Harris's avatar Jim Harris Committed by Tomasz Zawadzki
Browse files

util: change spdk_cpuset_count implementation to just count bit by bit



No change in functionality with this patch, but it helps prepare
for an upcoming patch that will provide a new iterator API for
cpuset.

Signed-off-by: default avatarJim Harris <jim.harris@samsung.com>
Change-Id: Idc75cb181f280e9dcfcf5a1debc79b51b2e9b27c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/23722


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
parent 54a1bea0
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -109,14 +109,15 @@ spdk_cpuset_count(const struct spdk_cpuset *set)
{
	uint32_t count = 0;
	uint8_t n;
	unsigned int i;
	unsigned int i, j;
	for (i = 0; i < sizeof(set->cpus); i++) {
		n = set->cpus[i];
		while (n) {
			n &= (n - 1);
		for (j = 0; j < 8; j++) {
			if (n & (1 << j)) {
				count++;
			}
		}
	}
	return count;
}