# HG changeset patch # User John W. Eaton # Date 1289284125 18000 # Node ID b79924abf776260b095d7941c7fee689f9f077d7 # Parent 94d9d412a2a07b902b1df7830edd893933dca167 Array.cc: use comparisons to sortmode values instead of testing mode directly diff -r 94d9d412a2a0 -r b79924abf776 liboctave/Array.cc --- a/liboctave/Array.cc Tue Nov 09 00:57:49 2010 -0500 +++ b/liboctave/Array.cc Tue Nov 09 01:28:45 2010 -0500 @@ -1711,7 +1711,7 @@ octave_sort lsort; - if (mode) + if (mode != UNSORTED) lsort.set_compare (mode); else return m; @@ -1833,7 +1833,7 @@ sidx = Array (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)); diff -r 94d9d412a2a0 -r b79924abf776 liboctave/ChangeLog --- a/liboctave/ChangeLog Tue Nov 09 00:57:49 2010 -0500 +++ b/liboctave/ChangeLog Tue Nov 09 01:28:45 2010 -0500 @@ -1,3 +1,9 @@ +2010-11-09 John W. Eaton + + * Array.cc (Array::sort, Array::is_sorted, + Array::is_sorted_rows): Use comparisons to sortmode values + instead of testing mode directly. + 2010-11-09 John W. Eaton * lo-mappers.cc (xmod, xrem): New functions.