Thomas Dreibholz writes:
On Thursday 30 June 2005 17:06, Peter Lei wrote:
I'm not sure what your concern is here. The Internet checksum
is just the ones's complement of (one's complement sum + carry).
That's two additional steps over a simple XOR sum.
XOR is computationally cheaper than addition. It works bit-wise and does not
need a carry.
Was that meant as a serious comment? I don't think that sort of
consideration applies to _any_ system built in the past 40 years or
so.
I'd think that choosing a commonly-implemented (and thus likely-to-
be-bug-free and well-supported and well-understood) algorithm would
trump any concern about bit twiddling at this level.
I suspect that most people who deal with TCP/IP already have a handy,
well-tested in_cksum() function available.