[PATCH] include/linux/bitops.h "integer" constants too large for u64

From: Mike Jones (ashmodai@ashmodai.com)
Date: Wed Jun 04 2003 - 19:15:58 EST


Hi,

I'm using GCC 3.3 to compile 2.5.70-mm4, and am being bombarded by
warnings regarding the use of integer constants in
include/linux/bitops.h. The attached patch, which is trivial, should
fix the problem.

Please CC me on any replies, as I am not subscribed to the linux-kernel
mailing list.

Regards,

Mike Jones

An excerpt of the warnings displayed on almost every compiled file:

include/linux/bitops.h: In function `generic_hweight64':
include/linux/bitops.h:118: warning: integer constant is too large for
"unsigned long" type
include/linux/bitops.h:118: warning: integer constant is too large for
"unsigned long" type
include/linux/bitops.h:119: warning: integer constant is too large for
"unsigned long" type
include/linux/bitops.h:119: warning: integer constant is too large for
"unsigned long" type
include/linux/bitops.h:120: warning: integer constant is too large for
"unsigned long" type
include/linux/bitops.h:120: warning: integer constant is too large for
"unsigned long" type
include/linux/bitops.h:121: warning: integer constant is too large for
"unsigned long" type
include/linux/bitops.h:121: warning: integer constant is too large for
"unsigned long" type
include/linux/bitops.h:122: warning: integer constant is too large for
"unsigned long" type
include/linux/bitops.h:122: warning: integer constant is too large for
"unsigned long" type


--- bitops.h 2003-06-04 20:06:07.000000000 -0400
+++ linux-2.5.70/include/linux/bitops.h 2003-06-04 20:03:56.000000000 -0400
@@ -115,12 +115,12 @@
                 return generic_hweight32((unsigned int)(w >> 32)) +
                                         generic_hweight32((unsigned int)w);
 
- 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 = (w & 0x5555555555555555ULL) + ((w >> 1) & 0x5555555555555555ULL);
+ res = (res & 0x3333333333333333ULL) + ((res >> 2) & 0x3333333333333333ULL);
+ res = (res & 0x0F0F0F0F0F0F0F0FULL) + ((res >> 4) & 0x0F0F0F0F0F0F0F0FULL);
+ res = (res & 0x00FF00FF00FF00FFULL) + ((res >> 8) & 0x00FF00FF00FF00FFULL);
+ res = (res & 0x0000FFFF0000FFFFULL) + ((res >> 16) & 0x0000FFFF0000FFFFULL);
+ return (res & 0x00000000FFFFFFFFULL) + ((res >> 32) & 0x00000000FFFFFFFFULL);
 }
 
 static inline unsigned long hweight_long(unsigned long w)



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jun 07 2003 - 22:00:25 EST