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
If I understand this correctly, Jeff, you want to have bitstring
functions that return the bit number directly rather then into a
return pointer.
Max, as far as I can tell Jeff's functions do not use the *value
construct, they return the bit number directly. Was that a type-o,
or am I misunderstanding the issue?
I agree. I presume that the bitstring array format will be the same as
is used in bit_ffs() and friends?
Then it just comes down to the name. 'range' is a misnomer. Maybe
something like 'quick', e.g. bit_ffs_quick(), to put whoever originally
came up with the 'int *value' design in his place. I dunno :-)
-Matt
Matthew Dillon
<dillon@xxxxxxxxxxxxx>
: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
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
[
Date Index][
Thread Index]