public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* hweight64
@ 2004-02-17 10:34 Pavel Machek
  2004-02-17 11:25 ` hweight64 Amit S. Kale
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Machek @ 2004-02-17 10:34 UTC (permalink / raw)
  To: Amit S. Kale, kernel list

Hi!

In kgdb patches you change prototype of hweight64. Why that change?

[This patch is reverse]

I do not see what it has to do with kgdb. Its true that result always
fits into int, but I'd be afraid of small sideeffects somewhere...

								Pavel


--- clean-mm/include/linux/bitops.h	2004-02-16 23:00:15.000000000 +0100
+++ linux-mm/include/linux/bitops.h	2003-06-24 12:28:05.000000000 +0200
@@ -108,7 +108,7 @@
         return (res & 0x0F) + ((res >> 4) & 0x0F);
 }
 
-static inline unsigned int generic_hweight64(__u64 w)
+static inline unsigned long generic_hweight64(__u64 w)
 {
 #if BITS_PER_LONG < 64
 	return generic_hweight32((unsigned int)(w >> 32)) +
@@ -120,8 +120,7 @@
 	res = (res & 0x0F0F0F0F0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F0F0F0F0F);
 	res = (res & 0x00FF00FF00FF00FF) + ((res >> 8) & 0x00FF00FF00FF00FF);
 	res = (res & 0x0000FFFF0000FFFF) + ((res >> 16) & 0x0000FFFF0000FFFF);
-	res = (res & 0x00000000FFFFFFFF) + ((res >> 32) & 0x00000000FFFFFFFF);
-	return (unsigned int)res;
+	return (res & 0x00000000FFFFFFFF) + ((res >> 32) & 0x00000000FFFFFFFF);
 #endif
 }
 

-- 
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]

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

* Re: hweight64
  2004-02-17 10:34 hweight64 Pavel Machek
@ 2004-02-17 11:25 ` Amit S. Kale
  2004-02-18  1:39   ` hweight64 Andi Kleen
  0 siblings, 1 reply; 3+ messages in thread
From: Amit S. Kale @ 2004-02-17 11:25 UTC (permalink / raw)
  To: Pavel Machek, Amit S. Kale, kernel list, KGDB bugreports
  Cc: Andi Kleen, Jim Houston, Tom Rini

Hi Pavel and kgdb gurus,

I inherited this change from x86_64 patch. Probably it was required on x86_64. 
I can't think of any reason why it is necessary.

Unless someone finds a problem with this patch, I am going to apply it.

-Amit

On Tuesday 17 Feb 2004 4:04 pm, Pavel Machek wrote:
> Hi!
>
> In kgdb patches you change prototype of hweight64. Why that change?
>
> [This patch is reverse]
>
> I do not see what it has to do with kgdb. Its true that result always
> fits into int, but I'd be afraid of small sideeffects somewhere...
>
> 								Pavel
>
>
> --- clean-mm/include/linux/bitops.h	2004-02-16 23:00:15.000000000 +0100
> +++ linux-mm/include/linux/bitops.h	2003-06-24 12:28:05.000000000 +0200
> @@ -108,7 +108,7 @@
>          return (res & 0x0F) + ((res >> 4) & 0x0F);
>  }
>
> -static inline unsigned int generic_hweight64(__u64 w)
> +static inline unsigned long generic_hweight64(__u64 w)
>  {
>  #if BITS_PER_LONG < 64
>  	return generic_hweight32((unsigned int)(w >> 32)) +
> @@ -120,8 +120,7 @@
>  	res = (res & 0x0F0F0F0F0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F0F0F0F0F);
>  	res = (res & 0x00FF00FF00FF00FF) + ((res >> 8) & 0x00FF00FF00FF00FF);
>  	res = (res & 0x0000FFFF0000FFFF) + ((res >> 16) & 0x0000FFFF0000FFFF);
> -	res = (res & 0x00000000FFFFFFFF) + ((res >> 32) & 0x00000000FFFFFFFF);
> -	return (unsigned int)res;
> +	return (res & 0x00000000FFFFFFFF) + ((res >> 32) & 0x00000000FFFFFFFF);
>  #endif
>  }


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

* Re: hweight64
  2004-02-17 11:25 ` hweight64 Amit S. Kale
@ 2004-02-18  1:39   ` Andi Kleen
  0 siblings, 0 replies; 3+ messages in thread
From: Andi Kleen @ 2004-02-18  1:39 UTC (permalink / raw)
  To: Amit S. Kale
  Cc: pavel, akale, linux-kernel, kgdb-bugreport, jim.houston, trini

On Tue, 17 Feb 2004 16:55:43 +0530
"Amit S. Kale" <amitkale@emsyssoft.com> wrote:

> Hi Pavel and kgdb gurus,
> 
> I inherited this change from x86_64 patch. Probably it was required on x86_64. 
> I can't think of any reason why it is necessary.
> 
> Unless someone finds a problem with this patch, I am going to apply it.

You can just remove it. It's not needed. kgdb does not even use hweight*

I checked some time ago with Jim Houston (from which it originated) and he said 
it was a merging error leaking from some Concurrent internal tree.

-Andi

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

end of thread, other threads:[~2004-02-17 11:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-17 10:34 hweight64 Pavel Machek
2004-02-17 11:25 ` hweight64 Amit S. Kale
2004-02-18  1:39   ` hweight64 Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox