Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Nov 1999 09:22:28 -0500 (EST)
From:      Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        Pierre Beyssac <beyssac@enst.fr>, Garrett Wollman <wollman@khavrinen.lcs.mit.edu>, Sheldon Hearn <sheldonh@uunet.co.za>, freebsd-current@FreeBSD.ORG
Subject:   Re: egcs -O breaks ping.c:in_cksum()
Message-ID:  <199911161422.JAA10973@khavrinen.lcs.mit.edu>
In-Reply-To: <Pine.BSF.4.10.9911161448210.780-100000@alphplex.bde.org>
References:  <19991115194357.T28348@enst.fr> <Pine.BSF.4.10.9911161448210.780-100000@alphplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
<<On Tue, 16 Nov 1999 15:17:43 +1100 (EST), Bruce Evans <bde@zeta.org.au> said:

> Perhaps the above should be written as:

> 		sum += ntohs(*(u_char *)w << 8);

> to avoid the undefined union access (answer.us).

No.  The IP checksum is defined in a manner which is
endian-independent.  Adding calls to ntohs() would only confuse
matters further.

-GAWollman

--
Garrett A. Wollman   | O Siem / We are all family / O Siem / We're all the same
wollman@lcs.mit.edu  | O Siem / The fires of freedom 
Opinions not those of| Dance in the burning flame
MIT, LCS, CRS, or NSA|                     - Susan Aglukark and Chad Irschick


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199911161422.JAA10973>