lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [lwip-devel] Checksum optimizations


From: Bill Auerbach
Subject: RE: [lwip-devel] Checksum optimizations
Date: Tue, 11 Mar 2008 10:07:27 -0400

Looking at this a bit close, I have to question:

  for(q = p; q != NULL; q = q->next) {

    acc += LWIP_CHKSUM(q->payload, q->len);

    while ((acc >> 16) != 0) {

      acc = (acc & 0xffffUL) + (acc >> 16);

    }

 

I don’t think:

 

    while ((acc >> 16) != 0) {

      acc = (acc & 0xffffUL) + (acc >> 16);

    }

 

Should be inside the for loop.  It makes no difference if the carry-outs are taken care of at the end versus in the loop.  Except as you noted in the loop there can only be one carry out and after the loop there could be 2.

 

inet_chksum_pbuf's use of this while loop can also be simplified as per your suggestion.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]