/* * This C procedure determines which bits are set in a 32-bit long integer * and fills up an array with the position numbers (zero based) of the * set bits. The number of bits set, and consequently the number of valid * entries in the array, is returned. */ #define BIT_SETSIZE 32 typedef unsigned long bit_set; int which_bits_set(bits_are_set, set_of_bits) int bits_are_set[]; bit_set set_of_bits; { int j, m; m = 0; for (j=0; j> 1; } return(m); }