1 /* 2 * Copyright (c) 2025 Robert Clausecker <fuz@FreeBSD.org> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7 #define FUNCSTEM stdc_count_ones 8 #define MKREFFUNC(name, type) \ 9 static unsigned \ 10 name(type value) \ 11 { \ 12 unsigned count = 0; \ 13 \ 14 while (value != 0) { \ 15 count += value & 1; \ 16 value >>= 1; \ 17 } \ 18 \ 19 return (count); \ 20 } 21 22 #include "stdbit-test-framework.c" 23