Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Jan 2012 10:07:03 -0800
From:      John-Mark Gurney <jmg@funkthat.com>
To:        Eitan Adler <lists@eitanadler.com>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, "Pedro F. Giffuni" <pfg@FreeBSD.org>, src-committers@FreeBSD.org
Subject:   Re: svn commit: r229415 - head/lib/libvgl
Message-ID:  <20120110180703.GF52468@funkthat.com>
In-Reply-To: <CAF6rxg=2BKy-_z_hRpX25U4dXhemha49gbajmvERmtkyBNH%2BYw@mail.gmail.com>
References:  <201201031947.q03JlXnx039684@svn.freebsd.org> <20120110040219.GE52468@funkthat.com> <CAF6rxg=2BKy-_z_hRpX25U4dXhemha49gbajmvERmtkyBNH%2BYw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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 <jmg@funkthat.com> 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."



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