Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Jan 2012 11:16:27 -0800 (PST)
From:      Pedro Giffuni <pfg@freebsd.org>
To:        Eitan Adler <lists@eitanadler.com>, John-Mark Gurney <jmg@funkthat.com>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: svn commit: r229415 - head/lib/libvgl
Message-ID:  <1326222987.8062.YahooMailClassic@web113516.mail.gq1.yahoo.com>
In-Reply-To: <20120110180703.GF52468@funkthat.com>

next in thread | previous in thread | raw e-mail | index | archive | help
=0A=0A--- Mar 10/1/12, John-Mark Gurney <jmg@funkthat.com> ha scritto:=0A=
=0A> Eitan Adler wrote this message on=0A> Mon, Jan 09, 2012 at 23:48 -0500=
:=0A> > On Mon, Jan 9, 2012 at 11:02 PM, John-Mark Gurney=0A> <jmg@funkthat=
.com>=0A> wrote:=0A> > > Last time I did benchmarking on this ~10 years=0A>=
 > > ago, it was slower to use xor instead of=0A> > > using assignments...=
=0A> > =0A> > I'd be shocked if the compiler didn't optimize this=0A> > awa=
y to an XCHG.=0A> =0A> As someone else mentioned, it did...=A0 But it's sti=
ll=0A> an obfuscation of the code...=A0 =0A> Not everyone knows this "trick=
" to swap two vars...=0A> If it isn't timing critical, it's better to be=0A=
> maintainable...=0A>=0A=0AThe code was taken from a book and it's pretty m=
uch=0Aubiquitous as-is. If not everyone knows this "trick",=0Athen I guess =
it simply proves that there is a lot of=0Avalue in reading books after all =
;-).=0A=0Acheers,=0A=0APedro.=0A



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1326222987.8062.YahooMailClassic>