[kaffe] CVS kaffe (robilad): make dcmpl and dcmpg comply with spec

Kaffe CVS cvs-commits at kaffe.org
Mon Feb 11 13:46:31 PST 2008


PatchSet 7739 
Date: 2008/02/11 21:44:41
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
make dcmpl and dcmpg comply with spec

2008-02-11  Dalibor Topic  <robilad at kaffe.org>

        * kaffe/kaffevm/soft.c (soft_dcmp): New function.
        Implements dcmpl/dcmpg according to VM spec.
        (soft_dcmpl, soft_dcmpg) Call soft_dcmp.

Members: 
	ChangeLog:1.5239->1.5240 
	kaffe/kaffevm/soft.c:1.83->1.84 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.5239 kaffe/ChangeLog:1.5240
--- kaffe/ChangeLog:1.5239	Sun Feb  3 15:08:29 2008
+++ kaffe/ChangeLog	Mon Feb 11 21:44:41 2008
@@ -1,3 +1,9 @@
+2008-02-11  Dalibor Topic  <robilad at kaffe.org>
+
+	* kaffe/kaffevm/soft.c (soft_dcmp): New function.
+	Implements dcmpl/dcmpg according to VM spec.
+	(soft_dcmpl, soft_dcmpg) Call soft_dcmp.
+
 2008-02-03  Dalibor Topic  <robilad at kaffe.org>
 
 	* config/arm/jit-arm.def (cvtfi_RxR): Removed.
Index: kaffe/kaffe/kaffevm/soft.c
diff -u kaffe/kaffe/kaffevm/soft.c:1.83 kaffe/kaffe/kaffevm/soft.c:1.84
--- kaffe/kaffe/kaffevm/soft.c:1.83	Sat Jan 19 15:13:39 2008
+++ kaffe/kaffe/kaffevm/soft.c	Mon Feb 11 21:44:43 2008
@@ -626,27 +626,28 @@
 	}
 }
 
+
+static
+jint
+soft_dcmp(const jdouble v1, const jdouble v2, const jint nan)
+{
+  if (v1 > v2)
+    return 1;
+  else if (v1 == v2)
+    return 0;
+  else if (v1 < v2)
+    return -1;
+  else 
+    return nan;
+}
+  
 /*
  * soft_dcmpg
  */
 jint
 soft_dcmpg(jdouble v1, jdouble v2)
 {
-	jint ret;
-	if ((!isinf(v1) && isnan(v1)) || (!isinf(v2) && isnan(v2))) {
-		ret = 1;
-	}
-	else if (v1 > v2) {
-		ret = 1;
-	}
-	else if (v1 == v2) {
-		ret = 0;
-	}
-	else {
-		ret = -1;
-	}
-
-	return (ret);
+  return soft_dcmp(v1, v2, 1);
 }
 
 /*
@@ -655,20 +656,7 @@
 jint
 soft_dcmpl(jdouble v1, jdouble v2)
 {
-        jint ret;
-	if ((!isinf(v1) && isnan(v1)) || (!isinf(v2) && isnan(v2))) {
-		ret = -1;
-	}
-        else if (v1 > v2) {
-                ret = 1;
-        }
-        else if (v1 == v2) {
-                ret = 0;
-        }
-        else {
-                ret = -1;
-        }
-	return (ret);
+  return soft_dcmp(v1, v2, -1);
 }
 
 /*




More information about the kaffe mailing list