This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: swap (a, b) suggestion


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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]