On Thu, Jun 26, 2003 at 10:42:14PM +0100, Sergio Masci wrote: > From: Daniel Serpell > > "lookup_table" should be aligned to a 256 byte boundary, again to avoid > > 16bit arithmetic. The code is 7cicles each "cbits" macro instead of > > 12 cicles in my last example, so the total is 81 cycles. That's 47 > > cycles less than the other example, and 256+81=337 words of program > > memory. > > > your 7 cycles do not include the CALL instruction Yes, I forgot that. So, it adds to 89 cycles. > Also you can cut the table down by 128 instructions if you post process the > bottom bit (push it into carry leaving top bit as 0 and cope with it latter), or > you can cut down the table to 16 bytes and place it in the data eeprom if you > look at 4 bits at a time. > > actually with the 128 element table solution you could collect all the discarded > bit 0's and add them at the end Yes, but less elements in the table means more cycle count. At 16 table entries the no-table approach is faster. Daniel. -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads