From owner-svn-src-all@FreeBSD.ORG Tue Jan 10 18:07:06 2012 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 02270106566C; Tue, 10 Jan 2012 18:07:06 +0000 (UTC) (envelope-from jmg@h2.funkthat.com) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) by mx1.freebsd.org (Postfix) with ESMTP id CA7DC8FC0A; Tue, 10 Jan 2012 18:07:05 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id q0AI73X8082213 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 10 Jan 2012 10:07:03 -0800 (PST) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id q0AI73D7082207; Tue, 10 Jan 2012 10:07:03 -0800 (PST) (envelope-from jmg) Date: Tue, 10 Jan 2012 10:07:03 -0800 From: John-Mark Gurney To: Eitan Adler Message-ID: <20120110180703.GF52468@funkthat.com> References: <201201031947.q03JlXnx039684@svn.freebsd.org> <20120110040219.GE52468@funkthat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Tue, 10 Jan 2012 10:07:03 -0800 (PST) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, "Pedro F. Giffuni" , src-committers@FreeBSD.org Subject: Re: svn commit: r229415 - head/lib/libvgl X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jan 2012 18:07:06 -0000 Eitan Adler wrote this message on Mon, Jan 09, 2012 at 23:48 -0500: > On Mon, Jan 9, 2012 at 11:02 PM, John-Mark Gurney wrote: > > Last time I did benchmarking on this ~10 years ago, it was slower to > > use xor instead of using assignments... > > I'd be shocked if the compiler didn't optimize this away to an XCHG. As someone else mentioned, it did... But it's still an obfuscation of the code... Not everyone knows this "trick" to swap two vars... If it isn't timing critical, it's better to be maintainable... Thanks. -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."