Skip to contentSkip to conversation

mips: Use hweight8

PATCH In review Akinobu Mita 2 participants 2 messages Nov 13, 2009 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mips: Use hweight8

Use hweight8 instead of counting for each bit

---
 arch/mips/mm/cerr-sb1.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)
arch/mips/mm/cerr-sb1.c +2 -5
index 1bd1f18..3571090 100644
@@ -567,13 +567,10 @@ static uint32_t extract_dc(unsigned short addr, int data)
 				datalo = ((unsigned long long)datalohi << 32) | datalolo;
 				ecc = dc_ecc(datalo);
 				if (ecc != datahi) {
-					int bits = 0;
+					int bits;
 					bad_ecc |= 1 << (3-offset);
 					ecc ^= datahi;
-					while (ecc) {
-						if (ecc & 1) bits++;
-						ecc >>= 1;
-					}
+					bits = hweight8(ecc);
 					res |= (bits == 1) ? CP0_CERRD_DATA_SBE : CP0_CERRD_DATA_DBE;
 				}
 				printk("  %02X-%016llX", datahi, datalo);
Signature · 1 line
1.6.5.1
#1 lore raw

On Fri, Nov 13, 2009 at 04:04:53PM +0900, Akinobu Mita wrote:

Thanks, queued for 2.6.33,

Ralf