From owner-cvs-all@FreeBSD.ORG Fri Apr 4 23:34:56 2003 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6CD3637B405; Fri, 4 Apr 2003 23:34:56 -0800 (PST) Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7CA2243F93; Fri, 4 Apr 2003 23:34:52 -0800 (PST) (envelope-from ru@whale.sunbay.crimea.ua) Received: from whale.sunbay.crimea.ua (ru@localhost [127.0.0.1]) h357Yagg052927 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 5 Apr 2003 10:34:36 +0300 (EEST) (envelope-from ru@whale.sunbay.crimea.ua) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.12.9/8.12.8/Submit) id h357YaIN052922; Sat, 5 Apr 2003 10:34:36 +0300 (EEST) (envelope-from ru) Date: Sat, 5 Apr 2003 10:34:36 +0300 From: Ruslan Ermilov To: Bruce Evans Message-ID: <20030405073436.GC52420@sunbay.com> References: <20030405164849.Y37179@gamplex.bde.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="mSxgbZZZvrAyzONB" Content-Disposition: inline In-Reply-To: <20030405164849.Y37179@gamplex.bde.org> User-Agent: Mutt/1.5.4i cc: David O'Brien cc: Poul-Henning Kamp cc: src-committers@FreeBSD.org cc: Nate Lawson cc: cvs-src@FreeBSD.org cc: cvs-all@FreeBSD.org cc: Mike Barcroft Subject: Re: cvs commit: src/sys/sys endian.h src/share/man/man9 byteorder.9 X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Apr 2003 07:34:56 -0000 --mSxgbZZZvrAyzONB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Apr 05, 2003 at 04:55:26PM +1000, Bruce Evans wrote: > On Fri, 4 Apr 2003, Nate Lawson wrote: >=20 > > On Fri, 4 Apr 2003, Ruslan Ermilov wrote: > > > +#define BSWAP16(x) (uint16_t) \ > > > + (((x) >> 8) | ((x) << 8)) > > > + > > > +#define BSWAP32(x) (uint32_t) \ > > > + (((x) >> 24) | (((x) >> 8) & 0xff00) | \ > > > + (((x) << 8) & 0xff0000) | ((x) << 24)) >=20 > > I don't mind the addition of the macros but I don't like the > > implementation. Too many unnecessary casts and overly complicated. >=20 > I fear it has not enough necessary casts :-). E.g., if x =3D (int16_t)0x= fffe, > then on 32-bit machines sign extension gives 0xffffffff for BSWAP16(x). > Of course, BSWAP16()'s arg should be precisely uint16_t, Yes, this is assumed. > but the function > interfaces don't require it to have the correct type except possibly on > non-2's complement machines where coercing the arg's type may cause > surprising changes to the arg's value. >=20 > Bruce --=20 Ruslan Ermilov Sysadmin and DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age --mSxgbZZZvrAyzONB Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE+jocMUkv4P6juNwoRAmLDAJ9Wn1LqW0kYum80wCldYR575K+wugCcD5ie kUsECNItgm69ahsmwinsS9g= =znhp -----END PGP SIGNATURE----- --mSxgbZZZvrAyzONB--