[kaffe] CVS kaffe (robilad): statified intToFloat

Kaffe CVS cvs-commits at kaffe.org
Thu Feb 14 16:08:27 PST 2008


PatchSet 7748 
Date: 2008/02/15 00:06:30
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
statified intToFloat

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

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

* kaffe/kaffevm/fp.h (FNANBITS, intToFloat): Removed.

Members: 
	ChangeLog:1.5248->1.5249 
	kaffe/kaffevm/fp.c:1.11->1.12 
	kaffe/kaffevm/fp.h:1.7->1.8 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.5248 kaffe/ChangeLog:1.5249
--- kaffe/ChangeLog:1.5248	Fri Feb 15 00:01:16 2008
+++ kaffe/ChangeLog	Fri Feb 15 00:06:30 2008
@@ -1,5 +1,12 @@
 2008-02-15  Dalibor Topic  <robilad at kaffe.org>
 
+	* kaffe/kaffevm/fp.c (intToFloat):  Simplified collapsing of NaNs.
+	Made function static.
+
+	* kaffe/kaffevm/fp.h (FNANBITS, intToFloat): Removed.
+
+2008-02-15  Dalibor Topic  <robilad at kaffe.org>
+
 	* kaffe/kaffevm/fp.c (floatAdd, floatSubtract, floatMultiply)
 	(floatDivide):  Use KAFFE_JFLOAT_NAN.
 
Index: kaffe/kaffe/kaffevm/fp.c
diff -u kaffe/kaffe/kaffevm/fp.c:1.11 kaffe/kaffe/kaffevm/fp.c:1.12
--- kaffe/kaffe/kaffevm/fp.c:1.11	Fri Feb 15 00:01:19 2008
+++ kaffe/kaffe/kaffevm/fp.c	Fri Feb 15 00:06:31 2008
@@ -88,17 +88,19 @@
 /*
  * Convert int to float.
  */
+static
 float
 intToFloat(jint val)
 {
 	jvalue d;
 
-	/* Force all possible NaN values into the canonical NaN value */
-	if ((val & FEXPMASK) == FEXPMASK && (val & FMANMASK) != 0)
-		val = FNANBITS;
-
 	/* Convert value */
 	d.i = val;
+
+	/* Force all possible NaN values into the canonical NaN value */
+	if (isnan(d.f))
+	  return KAFFE_JFLOAT_NAN;
+
 	return d.f;
 }
 
Index: kaffe/kaffe/kaffevm/fp.h
diff -u kaffe/kaffe/kaffevm/fp.h:1.7 kaffe/kaffe/kaffevm/fp.h:1.8
--- kaffe/kaffe/kaffevm/fp.h:1.7	Thu Feb 14 23:42:22 2008
+++ kaffe/kaffe/kaffevm/fp.h	Fri Feb 15 00:06:32 2008
@@ -27,7 +27,6 @@
 #define FMANMASK	0x007fffff
 #define FSIGNBIT	0x80000000
 #define FINFBITS	0x7f800000
-#define FNANBITS	0x7fc00000
 
 extern jfloat	floatAdd(jfloat v1, jfloat v2);
 extern jdouble	doubleAdd(jdouble v1, jdouble v2);
@@ -40,7 +39,6 @@
 
 extern jlong	doubleToLong(jdouble val);
 extern jint	floatToInt(jfloat val);
-extern float	intToFloat(jint val);
 
 #endif /* __fp_h */
 




More information about the kaffe mailing list