linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mips: Use hweight8
@ 2009-11-13  7:04 Akinobu Mita
  2009-11-13 10:56 ` Ralf Baechle
  0 siblings, 1 reply; 2+ messages in thread
From: Akinobu Mita @ 2009-11-13  7:04 UTC (permalink / raw)
  To: linux-mips; +Cc: Akinobu Mita, Ralf Baechle

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mips: Use hweight8
  2009-11-13  7:04 [PATCH] mips: Use hweight8 Akinobu Mita
@ 2009-11-13 10:56 ` Ralf Baechle
  0 siblings, 0 replies; 2+ messages in thread
From: Ralf Baechle @ 2009-11-13 10:56 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: linux-mips

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

Thanks, queued for 2.6.33,

  Ralf

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-13 10:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-13  7:04 [PATCH] mips: Use hweight8 Akinobu Mita
2009-11-13 10:56 ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).