|
From: | Bill Auerbach |
Subject: | RE: [lwip-devel] Checksum optimizations |
Date: | Tue, 11 Mar 2008 11:20:17 -0400 |
I missed a curly brace – I see why
it’s done like it is. As mentioned, the while loop can still be
safely omitted. Bill From: 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. |
[Prev in Thread] | Current Thread | [Next in Thread] |