6 * bitops - bit counting routines
8 * These offer convenience wrappers around (and, as necessary,
9 * replacements for) the builtin bit testing/counting routines.
12 * #include <ccan/bitops/bitops.h>
15 * int main(int argc, char *argv[])
17 * unsigned int v = atoi(argv[1]);
19 * printf("Number of 1 bits: %i\n", bitops_weight32(v));
21 * printf("Least-significant set bit: %i\n", bitops_ls32(v));
22 * printf("Most-significant set bit: %i\n", bitops_hs32(v));
23 * printf("Least-significant clear bit: %i\n", bitops_lc32(v));
24 * printf("Most-significant clear bit: %i\n", bitops_hc32(v));
29 * License: CC0 (Public Domain)
30 * Author: Rusty Russell <rusty@rustcorp.com.au>
32 int main(int argc, char *argv[])
34 /* Expect exactly one argument */
38 if (strcmp(argv[1], "depends") == 0) {