Mercurial > hg > octave-nkf
changeset 11210:b79924abf776
Array.cc: use comparisons to sortmode values instead of testing mode directly
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 09 Nov 2010 01:28:45 -0500 |
parents | 94d9d412a2a0 |
children | 2554b4a0806e |
files | liboctave/Array.cc liboctave/ChangeLog |
diffstat | 2 files changed, 13 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/Array.cc +++ b/liboctave/Array.cc @@ -1711,7 +1711,7 @@ octave_sort<T> lsort; - if (mode) + if (mode != UNSORTED) lsort.set_compare (mode); else return m; @@ -1833,7 +1833,7 @@ sidx = Array<octave_idx_type> (dv); octave_idx_type *vi = sidx.fortran_vec (); - if (mode) + if (mode != UNSORTED) lsort.set_compare (mode); else return m; @@ -1970,7 +1970,7 @@ if (n <= 1) return mode ? mode : ASCENDING; - if (! mode) + if (mode == UNSORTED) { // Auto-detect mode. compare_fcn_type compare @@ -1982,7 +1982,7 @@ mode = ASCENDING; } - if (mode) + if (mode != UNSORTED) { lsort.set_compare (safe_comparator (mode, *this, false)); @@ -2023,7 +2023,7 @@ if (r <= 1 || c == 0) return mode ? mode : ASCENDING; - if (! mode) + if (mode == UNSORTED) { // Auto-detect mode. compare_fcn_type compare @@ -2054,11 +2054,11 @@ mode = DESCENDING; } } - if (! mode && i == cols ()) + if (mode == UNSORTED && i == cols ()) mode = ASCENDING; } - if (mode) + if (mode != UNSORTED) { lsort.set_compare (safe_comparator (mode, *this, false));
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,9 @@ +2010-11-09 John W. Eaton <jwe@octave.org> + + * Array.cc (Array<T>::sort, Array<T>::is_sorted, + Array<T>::is_sorted_rows): Use comparisons to sortmode values + instead of testing mode directly. + 2010-11-09 John W. Eaton <jwe@octave.org> * lo-mappers.cc (xmod, xrem): New functions.