Optimizing CRC16 routine.


Results 1 to 20 of 20

Threaded View

  1. #6
    Join Date
    Aug 2005
    Location
    Michigan, USA
    Posts
    224


    Did you find this post helpful? Yes | No

    Default

    Greetings Henrik,

    Is there a chance you have a lot of overhead associated with array handling? Have you looked at the assembly language generated by that routine?

    I checked out the inner loop using BoostC and found worst case cycle times of 123 cycles in a "for/next" loop and 100 cycles in a "do/while" loop.

    Cheerful regards, Mike

    Code:
      crcword ^= work;         // 123 cycles (BoostC)
      for(char i=0; i<8; i++)  //                      
      { crcword >>= 1;         //
        if(status.C)           //
          crcword ^= 0x0A01;   //
      }
    Code:
      crcword ^= work; i = 0;   // 100 cycles (BoostC)
      do {                      //
        crcword >>= 1;          //
        if(status.C)            //
          crcword ^= 0x0A01;    //
        i++;                    //
      } while(i.3 == 0);        //
    Last edited by Mike, K8LH; - 16th January 2011 at 18:57.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts