call for API review: new bitstring functions

Jeffrey Hsu hsu at freebsd.org
Thu Jan 1 23:28:51 PST 2004


I need to find the first and last bit set within a subrange of an array
of bits.  Rather than make up an adhoc API for these two functions, I
propose adding the following general functions to the bitstring(3) API:
/* Return the first bit set in the range [n, m] or -1 if none found. */
int bit_ffsrange(bitstr_t *name, int n, int m)
/* Return the highest (last) bit set in the range [n, m] or -1 if none 
found. */
int bit_lfsrange(bitstr_t *name, int n, int m)

							Jeffrey





More information about the Kernel mailing list