Commits

Aidan Kehoe committed 3bfcdeb

Return a fixnum as documented with marker arg, #'max, #'min

2013-12-15 Aidan Kehoe <kehoea@parhasard.net>

* data.c (Fmax):
* data.c (Fmin):
When an argument is a marker or a character, and WITH_NUMBER_TYPES
is defined, return a fixnum in these functions as is documented
and as the non-NUMBER_TYPES code does.

  • Participants
  • Parent commits 4e69b24

Comments (0)

Files changed (2)

+2013-12-15  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* data.c (Fmax):
+	* data.c (Fmin):
+	When an argument is a marker or a character, and WITH_NUMBER_TYPES
+	is defined, return a fixnum in these functions as is documented
+	and as the non-NUMBER_TYPES code does.
+
 2013-09-10  Stephen J. Turnbull  <stephen@xemacs.org>
 
 	* font-mgr.c: Fix a bunch of comments and reformat some docstrings.
 {
 #ifdef WITH_NUMBER_TYPES
   REGISTER int i, maxindex = 0;
-  Lisp_Object comp1, comp2;
 
   while (!(CHARP (args[0]) || MARKERP (args[0]) || REALP (args[0])))
     args[0] = wrong_type_argument (Qnumber_char_or_marker_p, args[0]);
     args[0] = make_fixnum (marker_position (args[0]));
   for (i = 1; i < nargs; i++)
     {
-      comp1 = args[maxindex];
-      comp2 = args[i];
-      switch (promote_args (&comp1, &comp2))
+      switch (promote_args (args + maxindex, args + i))
 	{
 	case FIXNUM_T:
-	  if (XREALFIXNUM (comp1) < XREALFIXNUM (comp2))
+	  if (XREALFIXNUM (args[maxindex]) < XREALFIXNUM (args[i]))
 	    maxindex = i;
 	  break;
 #ifdef HAVE_BIGNUM
 	case BIGNUM_T:
-	  if (bignum_lt (XBIGNUM_DATA (comp1), XBIGNUM_DATA (comp2)))
+	  if (bignum_lt (XBIGNUM_DATA (args[maxindex]),
+			 XBIGNUM_DATA (args[i])))
 	    maxindex = i;
 	  break;
 #endif
 #ifdef HAVE_RATIO
 	case RATIO_T:
-	  if (ratio_lt (XRATIO_DATA (comp1), XRATIO_DATA (comp2)))
+	  if (ratio_lt (XRATIO_DATA (args[maxindex]), XRATIO_DATA (args[i])))
 	    maxindex = i;
 	  break;
 #endif
 	case FLOAT_T:
-	  if (XFLOAT_DATA (comp1) < XFLOAT_DATA (comp2))
+	  if (XFLOAT_DATA (args[maxindex]) < XFLOAT_DATA (args[i]))
 	    maxindex = i;
 	  break;
 #ifdef HAVE_BIGFLOAT
 	case BIGFLOAT_T:
-	  if (bigfloat_lt (XBIGFLOAT_DATA (comp1), XBIGFLOAT_DATA (comp2)))
+	  if (bigfloat_lt (XBIGFLOAT_DATA (args[maxindex]),
+			   XBIGFLOAT_DATA (args[i])))
 	    maxindex = i;
 	  break;
 #endif
 {
 #ifdef WITH_NUMBER_TYPES
   REGISTER int i, minindex = 0;
-  Lisp_Object comp1, comp2;
 
   while (!(CHARP (args[0]) || MARKERP (args[0]) || REALP (args[0])))
     args[0] = wrong_type_argument (Qnumber_char_or_marker_p, args[0]);
     args[0] = make_fixnum (marker_position (args[0]));
   for (i = 1; i < nargs; i++)
     {
-      comp1 = args[minindex];
-      comp2 = args[i];
-      switch (promote_args (&comp1, &comp2))
+      switch (promote_args (args + minindex, args + i))
 	{
 	case FIXNUM_T:
-	  if (XREALFIXNUM (comp1) > XREALFIXNUM (comp2))
+	  if (XREALFIXNUM (args[minindex]) > XREALFIXNUM (args[i]))
 	    minindex = i;
 	  break;
 #ifdef HAVE_BIGNUM
 	case BIGNUM_T:
-	  if (bignum_gt (XBIGNUM_DATA (comp1), XBIGNUM_DATA (comp2)))
+	  if (bignum_gt (XBIGNUM_DATA (args[minindex]),
+			 XBIGNUM_DATA (args[i])))
 	    minindex = i;
 	  break;
 #endif
 #ifdef HAVE_RATIO
 	case RATIO_T:
-	  if (ratio_gt (XRATIO_DATA (comp1), XRATIO_DATA (comp2)))
+	  if (ratio_gt (XRATIO_DATA (args[minindex]),
+			XRATIO_DATA (args[i])))
 	    minindex = i;
 	  break;
 #endif
 	case FLOAT_T:
-	  if (XFLOAT_DATA (comp1) > XFLOAT_DATA (comp2))
+	  if (XFLOAT_DATA (args[minindex]) > XFLOAT_DATA (args[i]))
 	    minindex = i;
 	  break;
 #ifdef HAVE_BIGFLOAT
 	case BIGFLOAT_T:
-	  if (bigfloat_gt (XBIGFLOAT_DATA (comp1), XBIGFLOAT_DATA (comp2)))
+	  if (bigfloat_gt (XBIGFLOAT_DATA (args[minindex]),
+			   XBIGFLOAT_DATA (args[i])))
 	    minindex = i;
 	  break;
 #endif