[Top][All Lists]
[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, 26 Feb 2008 15:18:02 -0500 |
> IHMO, next code will be better, since "if" usually more expensive then
> arithmetic instructions.
>
> acc = (acc & 0xffff) + (acc >> 16);
Yes, this is true, particularly on the PPC I'm using which has an
instruction cache. It might be faster to do the math even if it's not
needed and avoid the test and branch. With the branch's target already in
cache maybe there's no penalty using the branch but the test may take as
long as the math it's trying to avoid.
Bill