This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: swap (a, b) suggestion
- To: Richard Henderson <rth at cygnus dot com>
- Subject: Re: swap (a, b) suggestion
- From: Stephen Williams <steve at icarus dot icarus dot com>
- Date: Mon, 05 Jan 1998 15:21:15 -0800
- cc: Eric Buddington <eric at sparrow dot vgernet dot net>, egcs at cygnus dot com
On Sat, Jan 03, 1998 at 06:11:23PM -0500, Eric Buddington wrote:
> For integer values, the following works, and is significantly faster:
>
> template <class T>
> inline void swap(T& a, T& b) {
> a ^= b;
> b ^= a;
> a ^= b;
> }
rth@cygnus.com said:
> If it is faster at all I'll warrent it is only so for depressingly
> register starved machines.
You mean like ix86 machines?
--steve