Subject: Re: ns_cksum.c - why are they duplicated ?
To: Jaromir Dolecek <>
From: Ignatios Souvatzis <>
List: tech-kern
Date: 04/05/2000 20:46:31
On Wed, Apr 05, 2000 at 12:30:34PM +0200, Jaromir Dolecek wrote:
> Hi,
> identical ns_cksum.c are present in
> syssrc/sys/arch/i386/i386/ns_cksum.c
> syssrc/sys/arch/m68k/m68k/ns_cksum.c
> syssrc/sys/arch/sh3/sh3/ns_cksum.c
> very similar (modulo some u_int8_t <--> u_char) version
> is in:
> syssrc/sys/netns/ns_cksum.c
> Only VAX has something different, with some assemply code in.
> Why the duplication is there ? Shouldn't the i386/m68k/sh3
> copies be killed ? Probably even the VAX one, the compiler
> does probably better job in optimizing the code than
> hand crafted assembly.

I wouldn't be so sure.

VAX assembler is indefinitely powerful, and (I guess) very difficult to
optimize... so unless you have benchmarks for both versions on the one 
dozen different VAX cpu classes out there, you better leave it alone.

As for the others: if it really is the same modulo u_int8_t/u_char, 
should switch to the generic one.