From owner-svn-src-head@FreeBSD.ORG Wed Jul 3 08:24:36 2013 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 7F0BB884; Wed, 3 Jul 2013 08:24:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 2ABF8136E; Wed, 3 Jul 2013 08:24:34 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id LAA09236; Wed, 03 Jul 2013 11:24:21 +0300 (EEST) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1UuIMP-0009IC-BI; Wed, 03 Jul 2013 11:24:21 +0300 Message-ID: <51D3DF64.8040500@FreeBSD.org> Date: Wed, 03 Jul 2013 11:23:00 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130405 Thunderbird/17.0.5 MIME-Version: 1.0 To: Bruce Evans Subject: Re: should_yield problem [Was: svn commit: r251322 - head/sys/kern] References: <201306031736.r53Hain5093431@svn.freebsd.org> <51D30463.50608@FreeBSD.org> <51D30CE8.7030803@FreeBSD.org> <51D31724.6090807@FreeBSD.org> <20130703134115.C1064@besplex.bde.org> In-Reply-To: <20130703134115.C1064@besplex.bde.org> X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: attilio@FreeBSD.org, svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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: Wed, 03 Jul 2013 08:24:36 -0000 on 03/07/2013 07:40 Bruce Evans said the following: > On Tue, 2 Jul 2013, Andriy Gapon wrote: >> distance = (signed)( i1 - i2 ) > > With 2's complement and benign overflow, this is no different from > 'distance = i1 - i2'. Given the particular context I'd say that there is a difference. > But signed counters are not wanted here. A > negative distance, or equivalently with 32-bit unsigned ints, an unsigned > difference of >= 0x80000000 means overflow or an initialization error. > Your bug is an initialization error. Right. But I'd rather produce a positive (unsigned) number than a negative number when such an error happens (and is detectable). Again, I am speaking about the concrete context. -- Andriy Gapon