From owner-freebsd-hackers@FreeBSD.ORG Tue Nov 25 00:10:12 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E658D16A4CF; Tue, 25 Nov 2003 00:10:12 -0800 (PST) Received: from storm.FreeBSD.org.uk (storm.FreeBSD.org.uk [194.242.157.42]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4F79743FE0; Tue, 25 Nov 2003 00:10:10 -0800 (PST) (envelope-from mark@grondar.org) Received: from storm.FreeBSD.org.uk (Ugrondar@localhost [127.0.0.1]) hAP8A8eJ099414; Tue, 25 Nov 2003 08:10:08 GMT (envelope-from mark@grondar.org) Received: (from Ugrondar@localhost)hAP8A8ls099413; Tue, 25 Nov 2003 08:10:08 GMT (envelope-from mark@grondar.org) X-Authentication-Warning: storm.FreeBSD.org.uk: Ugrondar set sender to mark@grondar.org using -f Received: from grondar.org (localhost [127.0.0.1])hAP88ODw039675; Tue, 25 Nov 2003 08:08:24 GMT (envelope-from mark@grondar.org) From: Mark Murray Message-Id: <200311250808.hAP88ODw039675@grimreaper.grondar.org> To: David Schultz In-Reply-To: Your message of "Mon, 24 Nov 2003 17:13:08 PST." <20031125011308.GA98148@VARK.homeunix.com> Date: Tue, 25 Nov 2003 08:08:24 +0000 Sender: mark@grondar.org X-Spam-Status: No, hits=1.2 required=5.0 tests=EMAIL_ATTRIBUTION,FROM_NO_LOWER,IN_REP_TO version=2.55 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) cc: freebsd-hackers@freebsd.org Subject: Re: Size-independent byte order swapping functions. X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2003 08:10:13 -0000 David Schultz writes: > > I'm not sure if dedicated epanic() is the best way to implement out-of-rang > e > > errors prevention - the more handy solution should cause compile error. > > See CTASSERT. There is an extremely limited number of sizes that are possible here, even with weird/theoretical architectures like 256-bit machines. Doesn't it make sense just to presume that out-of-range is impossible, and recode for default "if (sizeof(x) == 1) return x;" (ignore syntax) ? M -- Mark Murray iumop ap!sdn w,I idlaH