On Fri, May 2, 2008 at 5:44 AM, Mark Lord <liml@xxxxxx> wrote: > By the way. If anyone can point out an existing EXPORTed > "count number of one bits" in a word function, then I'll very happily > submit a followup patch to remove this (below) and use that instead. > > .. > > > > +static int mv_count_pmp_links(unsigned int pmp_map) > > +{ > > + unsigned int link_count = 0; > > + > > + while (pmp_map) { > > + link_count += (pmp_map & 1); > > + pmp_map >>= 1; > > + } > > + return link_count; > > +} > > > .. > > I grepped for one, but didn't find one. include/asm-ia64/bitops.h:hweight64() grundler <2186>fgrep hweight include/asm/* include/asm/bitops_32.h:#include <asm-generic/bitops/hweight.h> include/asm/bitops_64.h:#include <asm-generic/bitops/hweight.h> > But there must be several of them already out there (?) yup. hth, grant > Speed is unimportant here, so this version above > has been left simple -- no table lookups. > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-ide" in > the body of a message to majordomo@xxxxxxxxxxxxxxx > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html