changeset 7929:30b952e90c29

misc 64-bit fixes
author John W. Eaton <jwe@octave.org>
date Tue, 15 Jul 2008 13:34:22 -0400
parents f728089c9543
children 1f6eb3de1c4e
files liboctave/ChangeLog liboctave/oct-sort.cc liboctave/oct-sort.h src/ChangeLog src/DLD-FUNCTIONS/__convn__.cc
diffstat 5 files changed, 20 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/ChangeLog	Tue Jul 15 09:47:34 2008 -0400
+++ b/liboctave/ChangeLog	Tue Jul 15 13:34:22 2008 -0400
@@ -1,3 +1,9 @@
+2008-07-15  John W. Eaton  <jwe@octave.org>
+
+	* oct-sort.cc, oct-sort.h (octave_sort<T>::count_run): Declare
+	descending arg as bool&.
+	(octave_sort<T>::sort): Pass bool to count_run for descending arg.
+
 2008-07-11  John W. Eaton  <jwe@octave.org>
 
 	* dDiagMatrix.cc (DiagMatrix::diag): Return empty ColumnVector if
--- a/liboctave/oct-sort.cc	Tue Jul 15 09:47:34 2008 -0400
+++ b/liboctave/oct-sort.cc	Tue Jul 15 13:34:22 2008 -0400
@@ -180,7 +180,7 @@
 
     lo[0] > lo[1] > lo[2] > ...
 
-Boolean *descending is set to 0 in the former case, or to 1 in the latter.
+DESCENDING is set to false in the former case, or to true in the latter.
 For its intended use in a stable mergesort, the strictness of the defn of
 "descending" is needed so that the caller can safely reverse a descending
 sequence without violating stability (strict > ensures there are no equal
@@ -190,11 +190,11 @@
 */
 template <class T>
 octave_idx_type
-octave_sort<T>::count_run (T *lo, T *hi, int *descending)
+octave_sort<T>::count_run (T *lo, T *hi, bool& descending)
 {
   octave_idx_type n;
 
-  *descending = 0;
+  descending = false;
   ++lo;
   if (lo == hi)
     return 1;
@@ -203,7 +203,7 @@
 
   IFLT (*lo, *(lo-1))
     {
-      *descending = 1;
+      descending = true;
       for (lo = lo+1; lo < hi; ++lo, ++n) 
 	{
 	  IFLT (*lo, *(lo-1))
@@ -943,11 +943,11 @@
       octave_idx_type minrun = merge_compute_minrun (nremaining);
       do 
 	{
-	  int descending;
+	  bool descending;
 	  octave_idx_type n;
 
 	  /* Identify next run. */
-	  n = count_run (lo, hi, &descending);
+	  n = count_run (lo, hi, descending);
 	  if (n < 0)
 	    goto fail;
 	  if (descending)
--- a/liboctave/oct-sort.h	Tue Jul 15 09:47:34 2008 -0400
+++ b/liboctave/oct-sort.h	Tue Jul 15 13:34:22 2008 -0400
@@ -164,7 +164,7 @@
   
   void binarysort (T *lo, T *hi, T *start);
     
-  octave_idx_type count_run (T *lo, T *hi, octave_idx_type *descending);
+  octave_idx_type count_run (T *lo, T *hi, bool& descending);
 
   octave_idx_type gallop_left (T key, T *a, octave_idx_type n, octave_idx_type hint);
 
--- a/src/ChangeLog	Tue Jul 15 09:47:34 2008 -0400
+++ b/src/ChangeLog	Tue Jul 15 13:34:22 2008 -0400
@@ -1,3 +1,8 @@
+2008-07-15  John W. Eaton  <jwe@octave.org>
+
+	* DLD-FUNCTIONS/__convn__.cc (convn): Cast second arg to
+	octave_idx_type in call to std::max.
+
 2008-07-14  John W. Eaton  <jwe@octave.org>
 
 	* Makefile.in (convhulln.oct, __delaunayn__.oct, __voronoi__.oct, 
--- a/src/DLD-FUNCTIONS/__convn__.cc	Tue Jul 15 09:47:34 2008 -0400
+++ b/src/DLD-FUNCTIONS/__convn__.cc	Tue Jul 15 13:34:22 2008 -0400
@@ -81,7 +81,8 @@
   // Allocate output
   dim_vector out_size (a_size);
   for (octave_idx_type n = 0; n < ndims; n++)
-    out_size(n) = std::max (a_size(n) - b_size(n) + 1, 0);
+    out_size(n) = std::max (a_size(n) - b_size(n) + 1,
+			    static_cast<octave_idx_type> (0));
 
   typedef typename octave_convn_traits<MTa, MTb>::TR MTout;