--- Mar 10/1/12, John-Mark Gurney <[email protected]> ha scritto:
> 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 > <[email protected]> > 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... > The code was taken from a book and it's pretty much ubiquitous as-is. If not everyone knows this "trick", then I guess it simply proves that there is a lot of value in reading books after all ;-). cheers, Pedro. _______________________________________________ [email protected] mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "[email protected]"
