Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the most efficient way to count the number of bits
which are set in a value?

Answer Posted / boomer

pseudo

int size is 32 bits...right?

for(i = 0 to 31)
{
count += (value & 1) //& = and oprator
shift left value
}

Is This Answer Correct ?    6 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a method in c?

1121


What is the purpose of void pointer?

1016


Write an algorithm for implementing insertion and deletion operations in a singly linked list using arrays ?

3501


What is modeling?

1032


What is a class c rental property?

1084


What is the size of structure in c?

1140


What is logical error?

1102


Is c compiled or interpreted?

1176


Is there any demerits of using pointer?

1053


illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question

2057


What are c header files?

981


What is the purpose of void in c?

1056


What are file streams?

995


What does double pointer mean in c?

1147


What are 'near' and 'far' pointers?

1019