X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fbitops%2F_info;fp=ccan%2Fbitops%2F_info;h=d47fe7b2ce0ae7e800a58050dc579da2a80d6d5f;hb=eb10bf9f4e37a73bae203dab71a4daffa2c96229;hp=0000000000000000000000000000000000000000;hpb=d872b7f22bc98092cad2aa4a456973bdbdb2c8fb;p=ccan diff --git a/ccan/bitops/_info b/ccan/bitops/_info new file mode 100644 index 00000000..d47fe7b2 --- /dev/null +++ b/ccan/bitops/_info @@ -0,0 +1,43 @@ +#include "config.h" +#include +#include + +/** + * bitops - bit counting routines + * + * These offer convenience wrappers around (and, as necessary, + * replacements for) the builtin bit testing/counting routines. + * + * Example: + * #include + * #include + * + * int main(int argc, char *argv[]) + * { + * unsigned int v = atoi(argv[1]); + * + * printf("Number of 1 bits: %i\n", bitops_weight32(v)); + * if (v != 0) { + * printf("Least-significant set bit: %i\n", bitops_ls32(v)); + * printf("Most-significant set bit: %i\n", bitops_hs32(v)); + * printf("Least-significant clear bit: %i\n", bitops_lc32(v)); + * printf("Most-significant clear bit: %i\n", bitops_hc32(v)); + * } + * return 0; + * } + * + * License: CC0 (Public Domain) + * Author: Rusty Russell + */ +int main(int argc, char *argv[]) +{ + /* Expect exactly one argument */ + if (argc != 2) + return 1; + + if (strcmp(argv[1], "depends") == 0) { + return 0; + } + + return 1; +}