Click here to Skip to main content
15,910,277 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Finding number of bits set in a given number Pin
Chris Losinger7-Mar-06 2:07
professionalChris Losinger7-Mar-06 2:07 
GeneralRe: Finding number of bits set in a given number Pin
toxcct7-Mar-06 2:25
toxcct7-Mar-06 2:25 
GeneralRe: Finding number of bits set in a given number Pin
Blake Miller7-Mar-06 3:23
Blake Miller7-Mar-06 3:23 
GeneralRe: Finding number of bits set in a given number Pin
toxcct7-Mar-06 3:27
toxcct7-Mar-06 3:27 
GeneralRe: Finding number of bits set in a given number Pin
BadKarma7-Mar-06 2:30
BadKarma7-Mar-06 2:30 
AnswerRe: Finding number of bits set in a given number Pin
Gary R. Wheeler7-Mar-06 2:51
Gary R. Wheeler7-Mar-06 2:51 
GeneralRe: Finding number of bits set in a given number Pin
toxcct7-Mar-06 2:53
toxcct7-Mar-06 2:53 
GeneralRe: Finding number of bits set in a given number Pin
Gary R. Wheeler7-Mar-06 2:59
Gary R. Wheeler7-Mar-06 2:59 
Actually, this is probably a reasonably fast solution, at least on Intel hardware. Bit shifts are done with a barrel shifter, which means all of the >> operations are done only in a 4-10 clock cycles IIRC. The & operations are similar. This means the entire expression could be evaluated in a few hundred clocks.

Yes, it's verbose. It has the advantage of simplicity, doesn't require a global table, and could be inlined if necessary.


Software Zen: delete this;
AnswerRe: Finding number of bits set in a given number Pin
BadKarma7-Mar-06 6:03
BadKarma7-Mar-06 6:03 
QuestionDirectShow SDK download Pin
Storm-blade7-Mar-06 0:03
professionalStorm-blade7-Mar-06 0:03 
AnswerRe: DirectShow SDK download Pin
Justin Tay7-Mar-06 5:26
Justin Tay7-Mar-06 5:26 
AnswerRe: question Pin
toxcct7-Mar-06 0:01
toxcct7-Mar-06 0:01 
QuestionUsing VC7.1 compiler under VC6 IDE.... woes.... :S Pin
kevingpo6-Mar-06 23:52
kevingpo6-Mar-06 23:52 
AnswerRe: Using VC7.1 compiler under VC6 IDE.... woes.... :S Pin
toxcct6-Mar-06 23:59
toxcct6-Mar-06 23:59 
GeneralRe: Using VC7.1 compiler under VC6 IDE.... woes.... :S Pin
kevingpo7-Mar-06 0:03
kevingpo7-Mar-06 0:03 
GeneralRe: Using VC7.1 compiler under VC6 IDE.... woes.... :S Pin
mkuhac7-Mar-06 2:01
mkuhac7-Mar-06 2:01 
AnswerRe: Using VC7.1 compiler under VC6 IDE.... woes.... :S Pin
Gary R. Wheeler7-Mar-06 2:55
Gary R. Wheeler7-Mar-06 2:55 
QuestionList View Multiple Selection Pin
Anil_vvs6-Mar-06 23:39
Anil_vvs6-Mar-06 23:39 
AnswerRe: List View Multiple Selection Pin
Nibu babu thomas6-Mar-06 23:47
Nibu babu thomas6-Mar-06 23:47 
AnswerRe: List View Multiple Selection Pin
Xing Chen7-Mar-06 16:14
Xing Chen7-Mar-06 16:14 
Questionread from physical memory Pin
ss20066-Mar-06 23:38
ss20066-Mar-06 23:38 
AnswerRe: read from physical memory Pin
fisp6-Mar-06 23:51
fisp6-Mar-06 23:51 
QuestionRe: read from physical memory Pin
David Crow7-Mar-06 3:49
David Crow7-Mar-06 3:49 
Questionread from physical memory Pin
ss20066-Mar-06 23:37
ss20066-Mar-06 23:37 
AnswerRe: read from physical memory Pin
toxcct6-Mar-06 23:41
toxcct6-Mar-06 23:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.