??? 08/14/07 08:56 Read: times |
#143245 - on optimisation Responding to: ???'s previous message |
Dan,
Thanks for the document. I also tried the paper&pencil method on the your routine above - it apparently works OK, but I am still puzzled why that number of moves between the three memory locations (that confuses me a lot I admit) - I guess this is the result of optimisation for PICs, is it? I could not resist, and (before I took the fist glimpse into that document; and also without an attempt to "tune" it specifically to SDCC or Keil, I swerve :-) ) I wrote down the following: void CRC1(unsigned char b) { b ^= CRCLo; CRCLo = CRCHi; CRCHi = b ^ (b << 4); CRCLo ^= (CRCHi >> 4) ^ (CRCHi << 3); CRCHi ^= (CRCHi >> 5); } This gave me 27 cycles on SDCC and 26 on Keil 7.5 eval I have here. Again, I admit this might be less optimal for PICs due to the different architecture. JW |