Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/14/06 14:00
Modified:
  12/14/06 14:02

Read: times


 
#129450 - I considered lookup tables.
Responding to: ???'s previous message
I considered lookup tables (they are viable for up to 12 bits, but become quite bloated for 16 bits), but found no easy way to generate the sequence for 16-bit numbers using a single 8-bit lookup table.

unsigned int Table[] =
{
	255, 127, 191, 223, 239, 247, 251, 253, 254, 63, 95, 111, 119, 123, 125, 126,
	159, 175, 183, 187, 189, 190, 207, 215, 219, 221, 222, 231, 235, 237, 238, 243,
	245, 246, 249, 250, 252, 31, 47, 55, 59, 61, 62, 79, 87, 91, 93, 94,
	103, 107, 109, 110, 115, 117, 118, 121, 122, 124, 143, 151, 155, 157, 158, 167,
	171, 173, 174, 179, 181, 182, 185, 186, 188, 199, 203, 205, 206, 211, 213, 214,
	217, 218, 220, 227, 229, 230, 233, 234, 236, 241, 242, 244, 248, 15, 23, 27,
	29, 30, 39, 43, 45, 46, 51, 53, 54, 57, 58, 60, 71, 75, 77, 78,
	83, 85, 86, 89, 90, 92, 99, 101, 102, 105, 106, 108, 113, 114, 116, 120,
	135, 139, 141, 142, 147, 149, 150, 153, 154, 156, 163, 165, 166, 169, 170, 172,
	177, 178, 180, 184, 195, 197, 198, 201, 202, 204, 209, 210, 212, 216, 225, 226,
	228, 232, 240, 7, 11, 13, 14, 19, 21, 22, 25, 26, 28, 35, 37, 38,
	41, 42, 44, 49, 50, 52, 56, 67, 69, 70, 73, 74, 76, 81, 82, 84,
	88, 97, 98, 100, 104, 112, 131, 133, 134, 137, 138, 140, 145, 146, 148, 152,
	161, 162, 164, 168, 176, 193, 194, 196, 200, 208, 224, 3, 5, 6, 9, 10,
	12, 17, 18, 20, 24, 33, 34, 36, 40, 48, 65, 66, 68, 72, 80, 96,
	129, 130, 132, 136, 144, 160, 192, 1, 2, 4, 8, 16, 32, 64, 128, 0
};


That is the table for 8-bit numbers. I cannot see an easy way to use it for 16-bit numbers. If I want the 10th element of the 16-bit sequence (which contains only one zero), using the 8-bit table will result in a number with 2 zeros.

List of 40 messages in thread
TopicAuthorDate
Looking for an algorithm.            01/01/70 00:00      
   I'd split it in two (or 4)            01/01/70 00:00      
      I've shown, in increseing detail, how to do it            01/01/70 00:00      
   Sorted, or only counted?            01/01/70 00:00      
      Counting is enough            01/01/70 00:00      
         Not sorting or counting then??            01/01/70 00:00      
            My approach.            01/01/70 00:00      
               Erik's idea is fast and simple!            01/01/70 00:00      
   did you even consider what I posted            01/01/70 00:00      
      I considered lookup tables.            01/01/70 00:00      
         look at my code it is right there            01/01/70 00:00      
         Can you explain your table?            01/01/70 00:00      
            Interpret it in binary            01/01/70 00:00      
               Hhm...            01/01/70 00:00      
                  Use of the table/algorithm            01/01/70 00:00      
                  misunderstanding            01/01/70 00:00      
                     Ah. I thought so.            01/01/70 00:00      
            explanation of table            01/01/70 00:00      
   table lookup            01/01/70 00:00      
   now, I'm confused            01/01/70 00:00      
      The keyword is "enumerate".            01/01/70 00:00      
         i give up since nobody can answer in english            01/01/70 00:00      
            Meaning #1            01/01/70 00:00      
               there must be some language problem here            01/01/70 00:00      
                  Basically, a)            01/01/70 00:00      
                     then this will work (and I believe the fastest)            01/01/70 00:00      
                        maybe yes            01/01/70 00:00      
                           maybe faster, but not6 what he ned            01/01/70 00:00      
                              it's sometimes not easy to describe what one needs            01/01/70 00:00      
                                 Sorting or counting            01/01/70 00:00      
                                    Bit shifting            01/01/70 00:00      
                                    I elaborated.            01/01/70 00:00      
                                       Christoph, have you tried...            01/01/70 00:00      
                                          It looks interesting ..            01/01/70 00:00      
                                             well, you said that...            01/01/70 00:00      
                                                here you are            01/01/70 00:00      
                                                   Works.            01/01/70 00:00      
                                                      compiler            01/01/70 00:00      
                                                         Benchmark            01/01/70 00:00      
                                                            thanks!            01/01/70 00:00      

Back to Subject List