Ruud van Silfhout wrote:
Hi,

I have made an extension for the reverse function in std_vector.hh. The code suggests to implement template specialisation for reverse vector<int>.
This is what I have done, plus specialisation for float and double vectors.
The code depends on the availability of memrev, which is not available on all platforms.So a check is required (during configure) to

on which platforms is it available?

[EMAIL PROTECTED] ~]$ grep memrev /usr/include/* /usr/include/c++/4.1.1/*/*
[EMAIL PROTECTED] ~]$

In case memrev is not available there are two options:
1. skip the specialized template implementation for <int> <float> <double> and keep the generic template code. This is what is implemented now. 2. implement a replacement for memrev. a simple replacement is added below. I don't know where to put it.

libc-extension.cc seems like a good place.

it uses malloc to allocate memory for each item. This can also be done using alloca, which allocates memory on the stack and, as a consequence,

Why not simply swap byte by byte in an inner loop?

--

Han-Wen Nienhuys - [EMAIL PROTECTED] - http://www.xs4all.nl/~hanwen

LilyPond Software Design
 -- Code for Music Notation
http://www.lilypond-design.com



_______________________________________________
lilypond-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to