DragonFly kernel List (threaded) for 2004-01
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]
Re: call for API review: new bitstring functions
On Friday 02 January 2004 08:28, Jeffrey Hsu wrote:
> 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
AFAIR, bitstring is "macro centric" and uses an additional reference to return
values, you'd like to keep that?! Apart from that I dislike the naming a bit
and would rather go for: bit_rffs(), bit_rfls() ... as it is already used for
the bit_n*-class functions.
btw, bit_lfsrange() should be bit_flsrange() IMO as it spells FindLastSet and
FindFirstSet not LastFindSet.
--
Best regards, | max@xxxxxxxxxxxxxx
Max Laier | ICQ #67774661
http://pf4freebsd.love2party.net/ | mlaier@EFnet #DragonFlyBSD
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]