Mercurial > hg > octave-nkf
changeset 11938:3b5a99b63570 release-3-0-x
backport sorting fixes
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Tue, 24 Feb 2009 07:53:24 +0100 |
parents | a08f22ff5ba1 |
children | a24565131108 |
files | liboctave/ChangeLog liboctave/oct-sort.cc |
diffstat | 2 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2009-02-05 Jaroslav Hajek <highegg@gmail.com> + + * oct-sort.cc (octave_sort<T>::merge_hi): std::copy -> + std::copy_backward where appropriate. + 2008-01-15 Rafael Laboissiere <rafael@debian.org> * oct-md5.cc: Include <cstdio>.
--- a/liboctave/oct-sort.cc +++ b/liboctave/oct-sort.cc @@ -29,8 +29,9 @@ replacing PyObject* with the type of the class T. * replaced usages of malloc, free, memcpy and memmove by standard C++ - new [], delete [] and std::copy. Note that replacing memmove by std::copy - is possible if the destination starts before the source. + new [], delete [] and std::copy and std::copy_backward. Note that replacing + memmove by std::copy is possible if the destination starts before the source. + If not, std::copy_backward needs to be used. The Python license is @@ -731,7 +732,7 @@ { dest -= k; pa -= k; - std::copy (pa+1, pa+1 + k, dest+1); + std::copy_backward (pa+1, pa+1 + k, dest+1 + k); na -= k; if (na == 0) goto Succeed; @@ -782,7 +783,7 @@ /* The first element of pb belongs at the front of the merge. */ dest -= na; pa -= na; - std::copy (pa+1, pa+1 + na, dest+1); + std::copy_backward (pa+1, pa+1 + na, dest+1 + na); *dest = *pb; return 0;