On Monday 13 December 2010 11:20:14 Johannes Berg wrote: > On Mon, 2010-12-13 at 11:52 +0100, Christian Lamparter wrote: > > > > + return !!(mask & BIT(0)) + !!(mask & BIT(1)) + !!(mask & BIT(2)); > > > +} > > > + > > I think there's a generic library function for that: > > hweight[8|16|32]. > > but note the !!, which makes this return 0, 1, 2 or 3 only, not the bit > weight. > what? the "Hamming weight/Population count" returns the number of symbols that are different from the zero-symbol. e.g.: The Hamming weight of 0x800000000000000000000000000000000 is just "1". Furthermore, if tx_chainmask contains now more than just the available tx_chains, then they can always mask the hweight* input with: AR9300_ANT_CHAIN_MASK (for 3x3) or AR9300_ANT_COMMON_MASK (for future 4x4) Regards, Chr -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html