From owner-svn-src-head@freebsd.org Thu Mar 3 06:18:47 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF5D5AC19C9; Thu, 3 Mar 2016 06:18:47 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id AB4221D2D; Thu, 3 Mar 2016 06:18:47 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c110-21-41-193.carlnfd1.nsw.optusnet.com.au (c110-21-41-193.carlnfd1.nsw.optusnet.com.au [110.21.41.193]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 4F2AF1048396; Thu, 3 Mar 2016 17:18:38 +1100 (AEDT) Date: Thu, 3 Mar 2016 17:18:38 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Justin Hibbits cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r296336 - in head/sys: dev/bhnd dev/pccard dev/pci isa kern sys x86/xen In-Reply-To: <201603030507.u2357ae2098576@repo.freebsd.org> Message-ID: <20160303164728.W1928@besplex.bde.org> References: <201603030507.u2357ae2098576@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=KvuwojiN c=1 sm=1 tr=0 a=73JWPhLeruqQCjN69UNZtQ==:117 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=9s81ovKKm4cCIyKOtWwA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Mar 2016 06:18:48 -0000 On Thu, 3 Mar 2016, Justin Hibbits wrote: > Log: > Replace all resource occurrences of '0UL/~0UL' with '0/~0'. > > Summary: > The idea behind this is '~0ul' is well-defined, and casting to uintmax_t, on a > 32-bit platform, will leave the upper 32 bits as 0. The maximum range of a > resource is 0xFFF.... (all bits of the full type set). By dropping the 'ul' > suffix, C type promotion rules apply, and the sign extension of ~0 on 32 bit > platforms gets it to a type-independent 'unsigned max'. Why not use the correct signed value? This value is -1, not the value, if any, with all bits 1. All bits 1 might be a trap representation, but it is unclear if ~0 can give a trap representation or a trap since it is unclear if the '~' operation acts on padding bits. It is clear that all bits 1 gives has value -0 in 1's complement if there are no no padding bits. But -0 has the same value as +0. When converted to an unsigned type, it loses all traces of its sign, and becomes plain (ufoo_t)0. I don't like the plan to change the resource range type to uintmax_t. 64 bits is just bloat for most 32-bit systems. After fixing all the hard-coded u_longs, you can just use a typdefed type which should be uint32_t if possible. Bruce