bit count in value from 0# Programming - 葵花宝典
c*e
1 楼
i knew I saw this somewhere before and finally found it today.
classical way of trading MEM for speed :-)
// Table that maps bytes to counts of the enabled bits in each value
00071 // from 0 to 255,
00072 //
00073 // nbits_[0] == 0
00074 //
00075 // because there are no bits enabled for the value 0.
00076 //
00077 // nbits_[5] == 2
00078 //
00079 // because there are 2 bits enabled in the value 5, i.e., it's
00080 // 101 in binary.
00081
00082 const char ACE_Handle_Set::nbits_[256] =
00083 {
000
classical way of trading MEM for speed :-)
// Table that maps bytes to counts of the enabled bits in each value
00071 // from 0 to 255,
00072 //
00073 // nbits_[0] == 0
00074 //
00075 // because there are no bits enabled for the value 0.
00076 //
00077 // nbits_[5] == 2
00078 //
00079 // because there are 2 bits enabled in the value 5, i.e., it's
00080 // 101 in binary.
00081
00082 const char ACE_Handle_Set::nbits_[256] =
00083 {
000