Re: [PATCH] Introduce a boolean "single_bit_set" function.
From: Petr Tesarik
Date: Mon Jun 29 2009 - 14:15:28 EST
Andrew Morton pÃÅe v PÃ 24. 04. 2009 v 10:46 -0700:
> On Fri, 24 Apr 2009 06:40:39 -0400 (EDT) "Robert P. J. Day" <rpjday@xxxxxxxxxxxxxx> wrote:
>
> > so it would be a simple matter to define the bit set boolean in
> > terms of hweight_long(), yes? so what about, in bitops.h:
> >
> > static inline bool
> > exactly_one_bit_set(unsigned long w)
> > {
> > return hweight_long(w) == 1;
> > }
> >
> > static inline bool
> > more_than_one_bit_set(unsigned long w)
> > {
> > return hweight_long(w) > 1;
> > }
> >
Andrew, you must be kidding! Are you seriously suggesting to replace a
simple and instruction with a call to an extern library function with 17
instructions (not including the call and ret)?
I'd better check the use of hweight in the kernel to eradicate as many
calls to it as possible...
Petr Tesarik
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/