|
From: | Andrey Volkov |
Subject: | Re: [lwip-devel] Checksum optimizations |
Date: | Tue, 26 Feb 2008 22:43:54 +0300 |
User-agent: | Thunderbird 2.0.0.9 (Windows/20071031) |
Hello Bill! Bill Auerbach wrote:
IHMO, next code will be better, since "if" usually more expensive then arithmetic instructions.In the inet_chksum.c code, there are 6 occurrences of:while ((acc >> 16) != 0) { acc = (acc & 0xffffUL) + (acc >> 16); }Is it not true that the loop can run a maximum of once? Wouldn’t this be slightly more efficient?if ((acc >> 16) != 0) { acc = (acc & 0xffffUL) + 1; }
acc = (acc & 0xffff) + (acc >> 16); -- Regards Andrey Volkov
[Prev in Thread] | Current Thread | [Next in Thread] |