[kaffe] CVS kaffe (robilad): removed doubleToLong and longToDouble functions

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


PatchSet 7750 
Date: 2008/02/15 01:32:30
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
removed doubleToLong and longToDouble functions

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

* configure.ac (AC_PROG_CC_C99): Ask for a C99 compiler, so that useful
ISO C99 macros like isnan and signbit are defined in math.h.

* kaffe/kaffevm/fp.c (doubleDivide): Return KAFFE_JDOUBLE_POS_INF or
KAFFE_JDOUBLE_NEG_INF depending on the signbit of input.
(doubleToLong, longToDouble): Removed unused functions.

* kaffe/kaffevm/baseClasses.c (initBaseClasses): Initialize KAFFE_JDOUBLE_NEG_INF
and KAFFE_JDOUBLE_POS_INF.

* kaffe/kaffevm/baseClasses.h (KAFFE_JDOUBLE_POS_INF, KAFFE_JDOUBLE_NEG_INF):
New fields used to cache Double.POSITIVE_INFINITY and Double.NEGATIVE_INFINITY.

Members: 
	ChangeLog:1.5250->1.5251 
	configure:1.639->1.640 
	configure.ac:1.309->1.310 
	kaffe/kaffevm/baseClasses.c:1.82->1.83 
	kaffe/kaffevm/baseClasses.h:1.27->1.28 
	kaffe/kaffevm/fp.c:1.13->1.14 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.5250 kaffe/ChangeLog:1.5251
--- kaffe/ChangeLog:1.5250	Fri Feb 15 00:12:26 2008
+++ kaffe/ChangeLog	Fri Feb 15 01:32:30 2008
@@ -1,5 +1,17 @@
 2008-02-15  Dalibor Topic  <robilad at kaffe.org>
 
+	* kaffe/kaffevm/fp.c (doubleDivide): Return KAFFE_JDOUBLE_POS_INF or
+	KAFFE_JDOUBLE_NEG_INF depending on the signbit of input.
+	(doubleToLong, longToDouble): Removed unused functions.
+	
+	* kaffe/kaffevm/baseClasses.c (initBaseClasses): Initialize KAFFE_JDOUBLE_NEG_INF
+	and KAFFE_JDOUBLE_POS_INF.
+
+	* kaffe/kaffevm/baseClasses.h (KAFFE_JDOUBLE_POS_INF, KAFFE_JDOUBLE_NEG_INF): 
+	New fields used to cache Double.POSITIVE_INFINITY and Double.NEGATIVE_INFINITY.
+
+2008-02-15  Dalibor Topic  <robilad at kaffe.org>
+
 	* kaffe/kaffevm/fp.c (floatToInt, doubleToLong): Made static.
 
 	* kaffe/kaffevm/fp.h (doubleToLong, floatToInt): Removed.
Index: kaffe/configure
diff -u kaffe/configure:1.639 kaffe/configure:1.640
--- kaffe/configure:1.639	Sat Feb  2 15:58:10 2008
+++ kaffe/configure	Fri Feb 15 01:32:34 2008
@@ -4027,6 +4027,207 @@
 fi
 
 
+   { echo "$as_me:$LINENO: checking for $CC option to accept ISO C99" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C99... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c99+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_c99=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <stdio.h>
+
+// Check varargs macros.  These examples are taken from C99 6.10.3.5.
+#define debug(...) fprintf (stderr, __VA_ARGS__)
+#define showlist(...) puts (#__VA_ARGS__)
+#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__))
+static void
+test_varargs_macros (void)
+{
+  int x = 1234;
+  int y = 5678;
+  debug ("Flag");
+  debug ("X = %d\n", x);
+  showlist (The first, second, and third items.);
+  report (x>y, "x is %d but y is %d", x, y);
+}
+
+// Check long long types.
+#define BIG64 18446744073709551615ull
+#define BIG32 4294967295ul
+#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)
+#if !BIG_OK
+  your preprocessor is broken;
+#endif
+#if BIG_OK
+#else
+  your preprocessor is broken;
+#endif
+static long long int bignum = -9223372036854775807LL;
+static unsigned long long int ubignum = BIG64;
+
+struct incomplete_array
+{
+  int datasize;
+  double data[];
+};
+
+struct named_init {
+  int number;
+  const wchar_t *name;
+  double average;
+};
+
+typedef const char *ccp;
+
+static inline int
+test_restrict (ccp restrict text)
+{
+  // See if C++-style comments work.
+  // Iterate through items via the restricted pointer.
+  // Also check for declarations in for loops.
+  for (unsigned int i = 0; *(text+i) != '\0'; ++i)
+    continue;
+  return 0;
+}
+
+// Check varargs and va_copy.
+static void
+test_varargs (const char *format, ...)
+{
+  va_list args;
+  va_start (args, format);
+  va_list args_copy;
+  va_copy (args_copy, args);
+
+  const char *str;
+  int number;
+  float fnumber;
+
+  while (*format)
+    {
+      switch (*format++)
+	{
+	case 's': // string
+	  str = va_arg (args_copy, const char *);
+	  break;
+	case 'd': // int
+	  number = va_arg (args_copy, int);
+	  break;
+	case 'f': // float
+	  fnumber = va_arg (args_copy, double);
+	  break;
+	default:
+	  break;
+	}
+    }
+  va_end (args_copy);
+  va_end (args);
+}
+
+int
+main ()
+{
+
+  // Check bool.
+  _Bool success = false;
+
+  // Check restrict.
+  if (test_restrict ("String literal") == 0)
+    success = true;
+  char *restrict newvar = "Another string";
+
+  // Check varargs.
+  test_varargs ("s, d' f .", "string", 65, 34.234);
+  test_varargs_macros ();
+
+  // Check flexible array members.
+  struct incomplete_array *ia =
+    malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
+  ia->datasize = 10;
+  for (int i = 0; i < ia->datasize; ++i)
+    ia->data[i] = i * 1.234;
+
+  // Check named initializers.
+  struct named_init ni = {
+    .number = 34,
+    .name = L"Test wide string",
+    .average = 543.34343,
+  };
+
+  ni.number = 58;
+
+  int dynamic_array[ni.number];
+  dynamic_array[ni.number - 1] = 543;
+
+  // work around unused variable warnings
+  return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
+	  || dynamic_array[ni.number - 1] != 543);
+
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -std=gnu99 -c99 -qlanglvl=extc99
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_c99=$ac_arg
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c99" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c99" in
+  x)
+    { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
+  xno)
+    { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c99"
+    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c99" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_c99" >&6; } ;;
+esac
+
+
+
 
 
 
@@ -7031,7 +7232,7 @@
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 7034 "configure"' > conftest.$ac_ext
+  echo '#line 7235 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -9591,11 +9792,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:9594: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:9795: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:9598: \$? = $ac_status" >&5
+   echo "$as_me:9799: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -9881,11 +10082,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:9884: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:10085: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:9888: \$? = $ac_status" >&5
+   echo "$as_me:10089: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -9985,11 +10186,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:9988: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:10189: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:9992: \$? = $ac_status" >&5
+   echo "$as_me:10193: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -12347,7 +12548,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 12350 "configure"
+#line 12551 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12447,7 +12648,7 @@
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 12450 "configure"
+#line 12651 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -14867,11 +15068,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14870: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15071: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:14874: \$? = $ac_status" >&5
+   echo "$as_me:15075: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -14971,11 +15172,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14974: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15175: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:14978: \$? = $ac_status" >&5
+   echo "$as_me:15179: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -16548,11 +16749,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16551: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16752: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:16555: \$? = $ac_status" >&5
+   echo "$as_me:16756: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -16652,11 +16853,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16655: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16856: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:16659: \$? = $ac_status" >&5
+   echo "$as_me:16860: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -18852,11 +19053,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:18855: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:19056: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:18859: \$? = $ac_status" >&5
+   echo "$as_me:19060: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -19142,11 +19343,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:19145: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:19346: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:19149: \$? = $ac_status" >&5
+   echo "$as_me:19350: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -19246,11 +19447,11 @@
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:19249: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:19450: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:19253: \$? = $ac_status" >&5
+   echo "$as_me:19454: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -25801,7 +26002,7 @@
 JAVA_TEST=Test.java
 CLASS_TEST=Test.class
 cat << \EOF > $JAVA_TEST
-/* #line 25804 "configure" */
+/* #line 26005 "configure" */
 public class Test {
 }
 EOF
Index: kaffe/configure.ac
diff -u kaffe/configure.ac:1.309 kaffe/configure.ac:1.310
--- kaffe/configure.ac:1.309	Sat Feb  2 15:58:10 2008
+++ kaffe/configure.ac	Fri Feb 15 01:32:34 2008
@@ -80,6 +80,7 @@
 
 dnl Find the compiler early on in case we need to override.
 AC_PROG_CC
+AC_PROG_CC_C99
 
 dnl If gcc is the compiler, compile with -Wall for lots of warnings
 
Index: kaffe/kaffe/kaffevm/baseClasses.c
diff -u kaffe/kaffe/kaffevm/baseClasses.c:1.82 kaffe/kaffe/kaffevm/baseClasses.c:1.83
--- kaffe/kaffe/kaffevm/baseClasses.c:1.82	Fri Feb 15 00:01:18 2008
+++ kaffe/kaffe/kaffevm/baseClasses.c	Fri Feb 15 01:32:36 2008
@@ -92,6 +92,8 @@
 Hjava_lang_Class* javaLangDoubleClass;
 
 jfloat KAFFE_JFLOAT_NAN;
+jdouble KAFFE_JDOUBLE_POS_INF;
+jdouble KAFFE_JDOUBLE_NEG_INF;
 jdouble KAFFE_JDOUBLE_NAN;
 
 Hjava_lang_Class *javaNioBufferClass;
@@ -426,11 +428,21 @@
 	    KAFFEVM_EXIT(-1);
 	  }
 
-	KAFFE_JFLOAT_NAN = KaffeJNI_GetStaticFloatField(NULL, javaLangFloatClass, 
-							  KNI_lookupFieldC(javaLangFloatClass,
-									   "NaN", true, &einfo));
-	KAFFE_JDOUBLE_NAN = KaffeJNI_GetStaticDoubleField(NULL, javaLangDoubleClass, 
-							  KNI_lookupFieldC(javaLangDoubleClass,
-									   "NaN", true, &einfo));
+	KAFFE_JFLOAT_NAN = 
+	  KaffeJNI_GetStaticFloatField(NULL, javaLangFloatClass, 
+				       KNI_lookupFieldC(javaLangFloatClass,
+							"NaN", true, &einfo));
+	KAFFE_JDOUBLE_POS_INF = 
+	  KaffeJNI_GetStaticDoubleField(NULL, javaLangDoubleClass, 
+					KNI_lookupFieldC(javaLangDoubleClass,
+							 "POSITIVE_INFINITY", true, &einfo));
+	KAFFE_JDOUBLE_NEG_INF = 
+	  KaffeJNI_GetStaticDoubleField(NULL, javaLangDoubleClass, 
+					KNI_lookupFieldC(javaLangDoubleClass,
+							 "NEGATIVE_INFINITY", true, &einfo));
+	KAFFE_JDOUBLE_NAN = 
+	  KaffeJNI_GetStaticDoubleField(NULL, javaLangDoubleClass, 
+					KNI_lookupFieldC(javaLangDoubleClass,
+							 "NaN", true, &einfo));
 }
 
Index: kaffe/kaffe/kaffevm/baseClasses.h
diff -u kaffe/kaffe/kaffevm/baseClasses.h:1.27 kaffe/kaffe/kaffevm/baseClasses.h:1.28
--- kaffe/kaffe/kaffevm/baseClasses.h:1.27	Fri Feb 15 00:01:19 2008
+++ kaffe/kaffe/kaffevm/baseClasses.h	Fri Feb 15 01:32:36 2008
@@ -50,7 +50,21 @@
 extern struct Hjava_lang_Class*	javaLangLongClass;
 extern struct Hjava_lang_Class*	javaLangFloatClass;
 extern struct Hjava_lang_Class*	javaLangDoubleClass;
+/**
+ * Cached value of java.lang.Float.NaN.
+ */
 extern jfloat KAFFE_JFLOAT_NAN;
+/**
+ * Cached value of java.lang.Double.POSITIVE_INFINITY.
+ */
+extern jdouble KAFFE_JDOUBLE_POS_INF;
+/**
+ * Cached value of java.lang.Double.NEGAIVE_INFINITY.
+ */
+extern jdouble KAFFE_JDOUBLE_NEG_INF;
+/**
+ * Cached value of java.lang.Double.NaN.
+ */
 extern jdouble KAFFE_JDOUBLE_NAN;
 
 extern struct Hjava_lang_Class *javaNioDirectByteBufferImplClass;
Index: kaffe/kaffe/kaffevm/fp.c
diff -u kaffe/kaffe/kaffevm/fp.c:1.13 kaffe/kaffe/kaffevm/fp.c:1.14
--- kaffe/kaffe/kaffevm/fp.c:1.13	Fri Feb 15 00:12:28 2008
+++ kaffe/kaffe/kaffevm/fp.c	Fri Feb 15 01:32:36 2008
@@ -22,56 +22,6 @@
 #include "fp.h"
 
 /*
- * Convert double to jlong.
- */
-static
-jlong
-doubleToLong(jdouble val)
-{
-	jvalue d;
-	d.d = val;
-
-#if defined(DOUBLE_ORDER_OPPOSITE)
-	{
-		/* swap low and high word */
-		uint32 r = *(uint32*)&d.j;
-		uint32 *s = (uint32*)&d.j + 1;
-		d.i = *s;
-		*s = r;
-	}
-#endif
-	return d.j;
-}
-
-/*
- * Convert jlong to double.
- */
-static
-jdouble
-longToDouble(jlong val)
-{
-	jvalue d;
-
-	/* Convert value */
-	d.j = val;
-#if defined(DOUBLE_ORDER_OPPOSITE)
-	{
-		/* swap low and high word */
-		uint32 r = *(uint32*)&d.j;
-		uint32 *s = (uint32*)&d.j + 1;
-		d.i = *s;
-		*s = r;
-	}
-#endif
-
-	/* Collapse NaNs */
-	if (isnan(d.d))
-	  return KAFFE_JDOUBLE_NAN;
-	else
-	  return d.d;
-}
-
-/*
  * Convert float to int.
  */
 static
@@ -181,11 +131,6 @@
 jdouble
 doubleDivide(jdouble v1, jdouble v2)
 {
-	jlong v1bits, v2bits;
-
-	v1bits = doubleToLong(v1);
-	v2bits = doubleToLong(v2);
-
 	if (isnan(v1) || isnan(v2)) {
 		return KAFFE_JDOUBLE_NAN;
 	}
@@ -195,7 +140,10 @@
 	if (v1 == 0.0) {
 	        return KAFFE_JDOUBLE_NAN;
 	}
-	return longToDouble((jlong)(DINFBITS | ((v1bits ^ v2bits) & DSIGNBIT)));
+	if (signbit(v1) ^ signbit(v2))
+	  return KAFFE_JDOUBLE_NEG_INF;
+	else
+	  return KAFFE_JDOUBLE_POS_INF;
 }
 
 /*




More information about the kaffe mailing list