From owner-freebsd-arch@FreeBSD.ORG Tue Feb 3 02:36:25 2004 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E206216A4CE for ; Tue, 3 Feb 2004 02:36:25 -0800 (PST) Received: from milla.ask33.net (milla.ask33.net [217.197.166.60]) by mx1.FreeBSD.org (Postfix) with ESMTP id A882043D1D for ; Tue, 3 Feb 2004 02:36:23 -0800 (PST) (envelope-from nick@milla.ask33.net) Received: by milla.ask33.net (Postfix, from userid 1001) id 1776C3ABB5D; Tue, 3 Feb 2004 11:38:05 +0100 (CET) Date: Tue, 3 Feb 2004 11:38:04 +0100 From: Pawel Jakub Dawidek To: Poul-Henning Kamp Message-ID: <20040203103804.GP4200@garage.freebsd.pl> References: <20040203083444.GM4200@garage.freebsd.pl> <6923.1075802515@critter.freebsd.dk> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="U+NfgObvpQT1Q9Yq" Content-Disposition: inline In-Reply-To: <6923.1075802515@critter.freebsd.dk> X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 4.8-RELEASE-p13 i386 X-URL: http://garage.freebsd.pl User-Agent: Mutt/1.5.1i cc: freebsd-arch@freebsd.org Subject: Re: Size-independent byte order swapping functions. X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Feb 2004 10:36:26 -0000 --U+NfgObvpQT1Q9Yq Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 03, 2004 at 11:01:55AM +0100, Poul-Henning Kamp wrote: +> >I'm planning to commit this patch: +> > +> > http://garage.freebsd.pl/patches/endian.h.patch +>=20 +> I have a hard time seeing a sensible use for these. +>=20 +> Endianess conversion is almost exclusively used in communications +> (even if the "transmission media" is a disk), and I can't possibly +> see how it can make sense to be lax about wordsize but strict about +> byteordering. +>=20 +> Could you please tell us what you need these for and why you could +> not use the explicitly sized families of endian functions ? I found them very useful while doing many such translations. It protect from problems when you need to manage many such transformations. For example, you have some structure: struct mystruct { uint16_t ms_foo; uint32_t ms_bar; uint64_t ms_foobar; }; and many places where you translate those fields. Suddenly, you need to change size of one of those fields. If you were using size-independent functions you don't need to change anything else, in other case diff will be much bigger with much mistake probability. Of course if only I found them useful, I'll stop right here. --=20 Pawel Jakub Dawidek http://www.FreeBSD.org pjd@FreeBSD.org http://garage.freebsd.pl FreeBSD committer Am I Evil? Yes, I Am! --U+NfgObvpQT1Q9Yq Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD) iD8DBQFAH3oMForvXbEpPzQRAkgSAJ9rg3kBVfmhUickNVTBzmjVr/JuXACePni+ +mRCAQGmosK4MC8Em204nxI= =xx5e -----END PGP SIGNATURE----- --U+NfgObvpQT1Q9Yq--