@Dave Got It Thanks
On Tue, Jul 12, 2011 at 1:23 AM, SkRiPt KiDdIe wrote:
> Got it :)
>
>
> On Tue, Jul 12, 2011 at 1:18 AM, Dave wrote:
>
>> @SkRiPt: Yes.
>>
>> Dave
>>
>> On Jul 11, 2:43 pm, SkRiPt KiDdIe wrote:
>> > are you saying that x finally contains the number of bits that are set
>
Got it :)
On Tue, Jul 12, 2011 at 1:18 AM, Dave wrote:
> @SkRiPt: Yes.
>
> Dave
>
> On Jul 11, 2:43 pm, SkRiPt KiDdIe wrote:
> > are you saying that x finally contains the number of bits that are set to
> > 1..??
> >
> >
> >
> > On Tue, Jul 12, 2011 at 1:09 AM, Dave wrote:
> > > @rShetty:
on executing the code :
#include
using namespace std;
int main()
{
int x=0x4000;
x = (x & 0x) + ((x >> 1) & 0x);
cout< wrote:
> @SkRiPt: Yes.
>
> Dave
>
> On Jul 11, 2:43 pm, SkRiPt KiDdIe wrote:
> > are you saying that x finally contains the number
@SkRiPt: Yes.
Dave
On Jul 11, 2:43 pm, SkRiPt KiDdIe wrote:
> are you saying that x finally contains the number of bits that are set to
> 1..??
>
>
>
> On Tue, Jul 12, 2011 at 1:09 AM, Dave wrote:
> > @rShetty: Ask a question. What do you need to know?
>
> > Dave
>
> > On Jul 11, 1:26 pm, rShet
are you saying that x finally contains the number of bits that are set to
1..??
On Tue, Jul 12, 2011 at 1:09 AM, Dave wrote:
> @rShetty: Ask a question. What do you need to know?
>
> Dave
>
> On Jul 11, 1:26 pm, rShetty wrote:
> > Some more Explanation of the working would be helpful
> >
> > Th
@rShetty: Ask a question. What do you need to know?
Dave
On Jul 11, 1:26 pm, rShetty wrote:
> Some more Explanation of the working would be helpful
>
> Thank You ..
>
> On Jul 11, 11:11 pm, Dave wrote:
>
>
>
> > Assuming that the integer is 32 bits, this is pretty good:
>
> > x = (x & 0x555
Some more Explanation of the working would be helpful
Thank You ..
On Jul 11, 11:11 pm, Dave wrote:
> Assuming that the integer is 32 bits, this is pretty good:
>
> x = (x & 0x) + ((x >> 1) & 0x);
> x = (x & 0x) + ((x >> 2) & 0x);
> x = (x & 0x0F0F0F0F) + ((x >
Assuming that the integer is 32 bits, this is pretty good:
x = (x & 0x) + ((x >> 1) & 0x);
x = (x & 0x) + ((x >> 2) & 0x);
x = (x & 0x0F0F0F0F) + ((x >> 4) & 0x0F0F0F0F);
x = (x & 0x00FF00FF) + ((x >> 8) & 0x00FF00FF);
x = (x & 0x) + ((x >> 16) & 0x