Re: Improved Swapping Method In sort.c

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Soumyadip Das Mahapatra <dip_kernel@...>
Cc: <linux-kernel@...>
Date: Wednesday, April 30, 2008 - 2:46 pm

Soumyadip Das Mahapatra wrote:

That was posted to comp.lang.c 20 years ago or more.  It's not something
that the compiler is likely to be able to optimize (unlike the normal
swap, using a temporary variable.)

Another cute, temp-free swap, from the same era, is: b += a -= b; a = b - a.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Improved Swapping Method In sort.c, Soumyadip Das Mahapatra, (Wed Apr 30, 1:09 pm)
Re: Improved Swapping Method In sort.c, H. Peter Anvin, (Fri May 2, 1:05 am)
Re: Improved Swapping Method In sort.c, David Newall, (Wed Apr 30, 2:46 pm)
Re: Improved Swapping Method In sort.c, Jan Engelhardt, (Wed Apr 30, 1:33 pm)
Re: Improved Swapping Method In sort.c, Sami Farin, (Wed Apr 30, 2:03 pm)
Re: Improved Swapping Method In sort.c, Jan Engelhardt, (Wed Apr 30, 1:30 pm)