DragonFly kernel List (threaded) for 2004-01
Re: call for API review: new bitstring functions
On Friday 02 January 2004 20:20, Matthew Dillon wrote:
> If I understand this correctly, Jeff, you want to have bitstring
> functions that return the bit number directly rather then into a
> return pointer.
I think Jeff was more about the additional range functionality than about the
direct returned value.
> 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?
It was not very clear in my relpy. What I mean is: bitstring.h uses macros not
functions so if you add stuff to it (like ranged checks), you might want to
conform to that. As long as the compiler can't inline there is some
overhead(+propolice) in the function aproach to be considered.
I agree, however, that a direct returned value is better from the programmer's
point of view, i.e. it makes more readable code.
> 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 :-)
No, range is fine (but too long ;))
Best regards, | max@xxxxxxxxxxxxxx
Max Laier | ICQ #67774661
http://pf4freebsd.love2party.net/ | mlaier@EFnet #DragonFlyBSD