public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Dobson <colpatch@us.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: William Lee Irwin III <wli@holomorphy.com>,
	"Martin J. Bligh" <mbligh@aracnet.com>,
	Dave Hansen <haveblue@us.ibm.com>
Subject: [patch] fix types for generic_hweight64
Date: Mon, 23 Jun 2003 16:36:14 -0700	[thread overview]
Message-ID: <3EF78EEE.4020706@us.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 351 bytes --]

A user reported to me that he had errors compiling a userspace portion 
of iptables because the u64 data type isn't exported to userspace.  This 
patch changes generic_hweight64 to use unsigned long longs instead of 
u64s.  It also changes the return type to unsigned int, to match the 
other generic_hweight functions.  Please apply.

Cheers!

-Matt

[-- Attachment #2: hweight64_fix.patch --]
[-- Type: text/plain, Size: 1247 bytes --]

diff -Nurp --exclude-from=/home/mcd/.dontdiff linux-2.5.73-vanilla/include/linux/bitops.h linux-2.5.73-hweight64_fix/include/linux/bitops.h
--- linux-2.5.73-vanilla/include/linux/bitops.h	Sun Jun 22 11:33:32 2003
+++ linux-2.5.73-hweight64_fix/include/linux/bitops.h	Mon Jun 23 11:31:18 2003
@@ -108,19 +108,20 @@ static inline unsigned int generic_hweig
         return (res & 0x0F) + ((res >> 4) & 0x0F);
 }
 
-static inline unsigned long generic_hweight64(__u64 w)
+static inline unsigned int generic_hweight64(unsigned long long w)
 {
 #if BITS_PER_LONG < 64
 	return generic_hweight32((unsigned int)(w >> 32)) +
 				generic_hweight32((unsigned int)w);
 #else
-	u64 res;
+	unsigned long long res;
 	res = (w & 0x5555555555555555) + ((w >> 1) & 0x5555555555555555);
 	res = (res & 0x3333333333333333) + ((res >> 2) & 0x3333333333333333);
 	res = (res & 0x0F0F0F0F0F0F0F0F) + ((res >> 4) & 0x0F0F0F0F0F0F0F0F);
 	res = (res & 0x00FF00FF00FF00FF) + ((res >> 8) & 0x00FF00FF00FF00FF);
 	res = (res & 0x0000FFFF0000FFFF) + ((res >> 16) & 0x0000FFFF0000FFFF);
-	return (res & 0x00000000FFFFFFFF) + ((res >> 32) & 0x00000000FFFFFFFF);
+	res = (res & 0x00000000FFFFFFFF) + ((res >> 32) & 0x00000000FFFFFFFF);
+	return (unsigned int)res;
 #endif
 }
 

                 reply	other threads:[~2003-06-23 23:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3EF78EEE.4020706@us.ibm.com \
    --to=colpatch@us.ibm.com \
    --cc=haveblue@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbligh@aracnet.com \
    --cc=wli@holomorphy.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox