either count it with a for loop or if you are using C, use __builtin_popcount(int x)
or x is given int count = 0; for(int i=0; i<32;i++) count += (x & (1<<i)) != 0; On Tue, Aug 3, 2010 at 12:04 PM, amit <amitjaspal...@gmail.com> wrote: > (3*4096+15*256+3*16+3). How many 1's are there in the binary > representation of the result. > > Is there a quick way to count the number of set bits in this number > manually??? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.