??? 12/14/06 15:49 Read: times |
#129481 - now, I'm confused Responding to: ???'s previous message |
I am looking for a fast algorithm which enumerates 16-bit integers, sorted by the number of bits that are set.
this would necessarily be a two step process 1) convert entries to bitcount (I suggested a fast way) 2) sort so, use any convenient sorting algorithm which will have something like if (a>b) and replace that by (add parantheses, typecasts and whatever) if ((table[a >>8] + table[a & 0xff]) > (table[b >>8] + table[b & 0xff])) Erik |