linux-mips
[Top] [All Lists]

[PATCH] mips: Use hweight8

To: linux-mips@linux-mips.org
Subject: [PATCH] mips: Use hweight8
From: Akinobu Mita <akinobu.mita@gmail.com>
Date: Fri, 13 Nov 2009 16:04:53 +0900
Cc: Akinobu Mita <akinobu.mita@gmail.com>, Ralf Baechle <ralf@linux-mips.org>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=hWaoejo14piY+iDKXTWpNDXA3HKlR9nR8fuo3SIggJs=; b=R6WnxyS5PxS5Ld0hW3yQBjFEpC2Ul8eQXoCrr5xaQJ5sX/mvMyxRQQvkNEwFixVlXm Tc95JlSfgkW0LPsaZ5qcPBlMBFNkibmY+3Mc+oXELooDb/tLdxY5rnKZrUMfo/ncf5w8 5uos99EdrgwKqGxKOyeyF9+jJ9EUuoQYF5P1A=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=nWEjhFXs4kk+fZQEn5M76YhPE0C2Hc4SWLZ0l65s6f0RAOzzpjJPzF/hYiQ5H3cEZW fuStu1JlMMRthzbSps5PWHjQbv7Rbj63bOPK5a/VkT/YKyzp8nX//V5sAm0emBjL4/bz uDKfAp72HTp2O/Rr45EDcMVt5xZyP9ErLK+mI=
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
Use hweight8 instead of counting for each bit

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
---
 arch/mips/mm/cerr-sb1.c |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/mips/mm/cerr-sb1.c b/arch/mips/mm/cerr-sb1.c
index 1bd1f18..3571090 100644
--- a/arch/mips/mm/cerr-sb1.c
+++ b/arch/mips/mm/cerr-sb1.c
@@ -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);
-- 
1.6.5.1


<Prev in Thread] Current Thread [Next in Thread>