Commit 7cb151c0 by Tom de Vries Committed by Tom de Vries

hwint.c: Fix loop range.

2012-07-17  Tom de Vries  <tom@codesourcery.com>

	* hwint.c: Fix loop range.

From-SVN: r189577
parent 440b6d59
2012-07-17 Tom de Vries <tom@codesourcery.com> 2012-07-17 Tom de Vries <tom@codesourcery.com>
* hwint.c: Fix loop range.
2012-07-17 Tom de Vries <tom@codesourcery.com>
* double-int.h (double_int_popcount): New inline function. * double-int.h (double_int_popcount): New inline function.
* hwint.c (popcount_hwi): New function. * hwint.c (popcount_hwi): New function.
* hwint.h (popcount_hwi): Declare function. New inline function. * hwint.h (popcount_hwi): Declare function. New inline function.
......
...@@ -113,8 +113,9 @@ int ...@@ -113,8 +113,9 @@ int
popcount_hwi (unsigned HOST_WIDE_INT x) popcount_hwi (unsigned HOST_WIDE_INT x)
{ {
int i, ret = 0; int i, ret = 0;
size_t bits = sizeof (x) * CHAR_BIT;
for (i = 0; i < sizeof (x); i += 1) for (i = 0; i < bits; i += 1)
{ {
ret += x & 1; ret += x & 1;
x >>= 1; x >>= 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment