swap (a, b) suggestion
Ulrich Drepper
drepper@cygnus.com
Tue Jan 6 14:09:00 GMT 1998
Gabriel.Dos-Reis@dptmaths.ens-cachan.fr (Gabriel Dos Reis) writes:
> specialisations for the template function swap<>() for
> integral types may be added. Uli ?
Well, as Richard said already, I don't think it's generally a good
idea to use this since the new version will not always be faster.
But still I keep this around for some more testing since one of the
checkes to libstdc++ which will hopefully become available in egcs
throughout the year is that there will be general headers as required
by the standard plus several sets of optional headers which define
special optimizations (by specializations) for each machine. For
those who know the structure of glibc 2.1, it'll be similar to how the
string.h and math.h headers are organized.
In such optimized header one could for (as Richard guessed)
register-poor machines add this hack for integral types but for ix86
it's still not the best solution (with some asm() hacking it should be
possible to use the xchg opcode).
-- Uli
---------------. drepper at gnu.org ,-. Rubensstrasse 5
Ulrich Drepper \ ,-------------------' \ 76149 Karlsruhe/Germany
Cygnus Solutions `--' drepper at cygnus.com `------------------------
More information about the Gcc
mailing list