How to find out how many bits are set (equal 1) in the product of two integers : <p>I am looking for an algorithm solution to find out how many bits are set (equal 1)  if I multiply two integers. I have numbers A and B, between 0 and MAX_INT, to eliminate the negative numbers. How do I find out how many bits will be set in the product C = A * B.</p>

<p>-of course calculating C and counting the bits is not the correct solution, it won't work for high values</p>

<p>-I work in C and C++, but it is a rather general algorithm problem. I must solve it without any math/boost library help.</p>

<p>Tried finding a general solution to know the bit count, but what I guessed only worked for quite some examples, it entirely failed with high numbers.</p>
