diff src/DLD-FUNCTIONS/sort.cc @ 4853:66b3cce2bf37

[project @ 2004-04-06 18:11:52 by jwe]
author jwe
date Tue, 06 Apr 2004 18:11:52 +0000
parents 047ff938b0d9
children d7bad86d3416
line wrap: on
line diff
--- a/src/DLD-FUNCTIONS/sort.cc	Tue Apr 06 17:25:59 2004 +0000
+++ b/src/DLD-FUNCTIONS/sort.cc	Tue Apr 06 18:11:52 2004 +0000
@@ -37,12 +37,11 @@
 #include "ov-cx-mat.h"
 #include "oct-sort.cc"
 
-/* If we are IEEE 754 or IEEE 854 compliant, then we can use the trick of
- * casting doubles as unsigned eight byte integers, and with a little
- * bit of magic we can automatically sort the NaN's correctly.
- */
+// If we have IEEE 754 data format, then we can use the trick of
+// casting doubles as unsigned eight byte integers, and with a little
+// bit of magic we can automatically sort the NaN's correctly.
 
-#if defined(HAVE_IEEE754_COMPLIANCE) && defined(EIGHT_BYTE_INT)
+#if defined (HAVE_IEEE754_DATA_FORMAT) && defined (EIGHT_BYTE_INT)
 
 static inline unsigned EIGHT_BYTE_INT FloatFlip(unsigned EIGHT_BYTE_INT f)
 {
@@ -123,7 +122,7 @@
   for (unsigned int i = 0; i < (unsigned int)dim; i++)
     stride *= dv(i);
 
-#if defined(HAVE_IEEE754_COMPLIANCE) && defined(EIGHT_BYTE_INT)
+#if defined (HAVE_IEEE754_DATA_FORMAT) && defined (EIGHT_BYTE_INT)
   double *v = m.fortran_vec ();
 
   unsigned EIGHT_BYTE_INT *p = (unsigned EIGHT_BYTE_INT *)v;
@@ -151,9 +150,9 @@
 	    }
 	  offset += offset2 * stride * ns;
 
-	  /* Flip the data in the vector so that int compares on 
-	   * IEEE754 give the correct ordering
-	   */
+	  // Flip the data in the vector so that int compares on
+	  // IEEE754 give the correct ordering.
+
 	  for (unsigned int i = 0; i < ns; i++)
 	    {
 	      vi[i]->vec = FloatFlip (p[i*stride + offset]);
@@ -162,19 +161,19 @@
 
 	  indexed_ieee754_sort.sort (vi, ns);
 
-	  /* Flip the data out of the vector so that int compares on
-	   *  IEEE754 give the correct ordering
-	   */
+	  // Flip the data out of the vector so that int compares on
+	  // IEEE754 give the correct ordering
+
 	  for (unsigned int i = 0; i < ns; i++)
 	    {
 	      p[i*stride + offset] = IFloatFlip (vi[i]->vec);
 	      idx(i*stride + offset) = vi[i]->indx;
 	    }
 
-	  /* There are two representations of NaN. One will be sorted to
-	   * the beginning of the vector and the other to the end. If it
-	   * will be sorted to the beginning, fix things up.
-	   */
+	  // There are two representations of NaN.  One will be sorted
+	  // to the beginning of the vector and the other to the end.
+	  // If it will be sorted to the beginning, fix things up.
+
 	  if (lo_ieee_signbit (octave_NaN))
 	    {
 	      unsigned int i = 0;
@@ -205,24 +204,25 @@
 	{
 	  for (unsigned int j = 0; j < iter; j++)
 	    {
-	      /* Flip the data in the vector so that int compares on 
-	       * IEEE754 give the correct ordering
-	       */
+	      // Flip the data in the vector so that int compares on
+	      // IEEE754 give the correct ordering.
+
 	      for (unsigned int i = 0; i < ns; i++)
 		p[i] = FloatFlip (p[i]);
 	      
 	      ieee754_sort.sort (p, ns);
 
-	      /* Flip the data out of the vector so that int compares on
-	       *  IEEE754 give the correct ordering
-	       */
+	      // Flip the data out of the vector so that int compares
+	      // on IEEE754 give the correct ordering.
+
 	      for (unsigned int i = 0; i < ns; i++)
 		p[i] = IFloatFlip (p[i]);
 
-	      /* There are two representations of NaN. One will be sorted to
-	       * the beginning of the vector and the other to the end. If it
-	       * will be sorted to the beginning, fix things up.
-	       */
+	      // There are two representations of NaN.  One will be
+	      // sorted to the beginning of the vector and the other
+	      // to the end.  If it will be sorted to the beginning,
+	      // fix things up.
+
 	      if (lo_ieee_signbit (octave_NaN))
 		{
 		  unsigned int i = 0;
@@ -253,24 +253,25 @@
 		}
 	      offset += offset2 * stride * ns;
 
-	      /* Flip the data in the vector so that int compares on 
-	       * IEEE754 give the correct ordering
-	       */
+	      // Flip the data in the vector so that int compares on
+	      // IEEE754 give the correct ordering.
+
 	      for (unsigned int i = 0; i < ns; i++)
 		vi[i] = FloatFlip (p[i*stride + offset]);
 
 	      ieee754_sort.sort (vi, ns);
 
-	      /* Flip the data out of the vector so that int compares on
-	       *  IEEE754 give the correct ordering
-	       */
+	      // Flip the data out of the vector so that int compares
+	      // on IEEE754 give the correct ordering.
+
 	      for (unsigned int i = 0; i < ns; i++)
 		p[i*stride + offset] = IFloatFlip (vi[i]);
 	      
-	      /* There are two representations of NaN. One will be sorted to
-	       * the beginning of the vector and the other to the end. If it
-	       * will be sorted to the beginning, fix things up.
-	       */
+	      // There are two representations of NaN. One will be
+	      // sorted to the beginning of the vector and the other
+	      // to the end. If it will be sorted to the beginning,
+	      // fix things up.
+
 	      if (lo_ieee_signbit (octave_NaN))
 		{
 		  unsigned int i = 0;
@@ -599,7 +600,6 @@
   return retval;
 }
 
-
 /*
 ;;; Local Variables: ***
 ;;; mode: C++ ***