Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > How to count bits in a unsigned int?

Reply
Thread Tools

How to count bits in a unsigned int?

 
 
Flash Gordon
Guest
Posts: n/a
 
      11-14-2005
Mockey Chen wrote:
> Excellent. thanks.
>
> I find a solution in c++:


<snip>

1) Please don't top post. You reply belongs under the text you are
replying to (after suitable trimming), not above. See most of the
posts on this group for examples.

2) We don't care about C++ solutions here, this is comp.lang.c. If you
want C++ go to comp.lang.c++

> "pete" <(E-Mail Removed)> wrote:(E-Mail Removed)...


<snip>
--
Flash Gordon
Living in interesting times.
Although my email address says spam, it is real and I read it.
 
Reply With Quote
 
 
 
 
Emmanuel Delahaye
Guest
Posts: n/a
 
      11-14-2005
Mockey Chen a écrit :
> On 32-bit platform, give you a unsigned int?
> what is the best way to get how many bits equal to 1.
> please do not use loop if possible?


Use recursion.

--
A+

Emmanuel Delahaye
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
(int) -> (unsigned) -> (int) or (unsigned) -> (int) -> (unsigned):I'll loose something? pozz C Programming 12 03-20-2011 11:32 PM
what about unsigned and signed 8 bits number, 16 bits, etc?? sarmin kho Python 2 06-15-2004 06:40 PM
Re: what about unsigned and signed 8 bits number, 16 bits, etc?? Miki Tebeka Python 1 06-14-2004 03:19 PM
8-Bits vs 12 or 16 bits/pixel; When does more than 8 bits count ? Al Dykes Digital Photography 3 12-29-2003 07:08 PM



Advertisments