[kaffe] CVS kaffe (robilad): statified longToDouble

Kaffe CVS cvs-commits at kaffe.org
Thu Feb 14 15:43:50 PST 2008


PatchSet 7746 
Date: 2008/02/14 23:42:20
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
statified longToDouble

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

* kaffe/kaffevm/fp.h (DNANBITS, longToDouble): Removed.

* kaffe/kaffevm/fp.c (longToDouble): Simplified collapsing of NaNs.
Made function static.

Members: 
	ChangeLog:1.5246->1.5247 
	kaffe/kaffevm/fp.c:1.9->1.10 
	kaffe/kaffevm/fp.h:1.6->1.7 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.5246 kaffe/ChangeLog:1.5247
--- kaffe/ChangeLog:1.5246	Thu Feb 14 23:31:38 2008
+++ kaffe/ChangeLog	Thu Feb 14 23:42:20 2008
@@ -1,5 +1,12 @@
 2008-02-15  Dalibor Topic  <robilad at kaffe.org>
 
+	* kaffe/kaffevm/fp.h (DNANBITS, longToDouble): Removed.
+
+	* kaffe/kaffevm/fp.c (longToDouble): Simplified collapsing of NaNs.
+	Made function static.
+
+2008-02-15  Dalibor Topic  <robilad at kaffe.org>
+
 	* kaffe/kaffevm/fp.c (doubleAdd, doubleSubtract, doubleMultiply)
 	(doubleDivide): Use KAFFE_JDOUBLE_NAN.
 
Index: kaffe/kaffe/kaffevm/fp.c
diff -u kaffe/kaffe/kaffevm/fp.c:1.9 kaffe/kaffe/kaffevm/fp.c:1.10
--- kaffe/kaffe/kaffevm/fp.c:1.9	Thu Feb 14 23:31:41 2008
+++ kaffe/kaffe/kaffevm/fp.c	Thu Feb 14 23:42:22 2008
@@ -48,15 +48,12 @@
 /*
  * Convert jlong to double.
  */
+static
 jdouble
 longToDouble(jlong val)
 {
 	jvalue d;
 
-	/* Force all possible NaN values into the canonical NaN value */
-	if ((val & DEXPMASK) == DEXPMASK && (val & DMANMASK) != 0)
-		val = DNANBITS;
-
 	/* Convert value */
 	d.j = val;
 #if defined(DOUBLE_ORDER_OPPOSITE)
@@ -68,7 +65,12 @@
 		*s = r;
 	}
 #endif
-	return d.d;
+
+	/* Collapse NaNs */
+	if (isnan(d.d))
+	  return KAFFE_JDOUBLE_NAN;
+	else
+	  return d.d;
 }
 
 /*
Index: kaffe/kaffe/kaffevm/fp.h
diff -u kaffe/kaffe/kaffevm/fp.h:1.6 kaffe/kaffe/kaffevm/fp.h:1.7
--- kaffe/kaffe/kaffevm/fp.h:1.6	Thu Feb 14 22:24:41 2008
+++ kaffe/kaffe/kaffevm/fp.h	Thu Feb 14 23:42:22 2008
@@ -22,7 +22,6 @@
 #define DMANMASK	((((uint64)0x000fffff)<<32)|((uint64)0xffffffff))
 #define DSIGNBIT	(((uint64)0x80000000)<<32)
 #define DINFBITS	(((uint64)0x7ff00000)<<32)
-#define DNANBITS	(((uint64)0x7ff80000)<<32)
 
 #define FEXPMASK	0x7f800000
 #define FMANMASK	0x007fffff
@@ -40,7 +39,6 @@
 extern jdouble	doubleDivide(jdouble v1, jdouble v2);
 
 extern jlong	doubleToLong(jdouble val);
-extern jdouble	longToDouble(jlong val);
 extern jint	floatToInt(jfloat val);
 extern float	intToFloat(jint val);
 




More information about the kaffe mailing list