]> git.ozlabs.org Git - ccan/blob - ccan/bitops/_info
crypto/shachain/tools: update to new rbuf API.
[ccan] / ccan / bitops / _info
1 #include "config.h"
2 #include <stdio.h>
3 #include <string.h>
4
5 /**
6  * bitops - bit counting routines
7  *
8  * These offer convenience wrappers around (and, as necessary,
9  * replacements for) the builtin bit testing/counting routines.
10  *
11  * Example:
12  * #include <ccan/bitops/bitops.h>
13  * #include <stdio.h>
14  *
15  * int main(int argc, char *argv[])
16  * {
17  *      unsigned int v = atoi(argv[1]);
18  *
19  *      printf("Number of 1 bits: %i\n", bitops_weight32(v));
20  *      if (v != 0) {
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));
25  *      }
26  *      return 0;
27  * }
28  *
29  * License: CC0 (Public Domain)
30  * Author: Rusty Russell <rusty@rustcorp.com.au>
31  */
32 int main(int argc, char *argv[])
33 {
34         /* Expect exactly one argument */
35         if (argc != 2)
36                 return 1;
37
38         if (strcmp(argv[1], "depends") == 0) {
39                 return 0;
40         }
41
42         return 1;
43 }