[cp-patches] FYI: PR 22800 fixed

Christian Thalinger twisti at complang.tuwien.ac.at
Thu Apr 5 12:44:07 UTC 2007


Hi!

I reverted the reverted patch because it's required.  See also:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22800.

This should finally fix all double-arm problems.

- twisti


---

2007-04-05  Christian Thalinger  <twisti at complang.tuwien.ac.at>

	PR classpath/22800:
	* native/jni/java-lang/java_lang_VMDouble.c (doubleToLongBits)
	(doubleToRawLongBits, longBitsToDouble): Swap the byte
	ordering for little-endian arms without VFP.


Index: native/jni/java-lang/java_lang_VMDouble.c
===================================================================
RCS file: /cvsroot/classpath/classpath/native/jni/java-lang/java_lang_VMDouble.c,v
retrieving revision 1.16
diff -u -3 -p -r1.16 java_lang_VMDouble.c
--- native/jni/java-lang/java_lang_VMDouble.c   28 Mar 2007 16:43:57 -0000      1.16
+++ native/jni/java-lang/java_lang_VMDouble.c   5 Apr 2007 12:40:49 -0000
@@ -125,6 +125,16 @@ Java_java_lang_VMDouble_doubleToLongBits
 
   val.d = doubleValue;
 
+#if defined(__IEEE_BYTES_LITTLE_ENDIAN)
+  /* On little endian ARM processors when using FPA, word order of
+     doubles is still big endian. So take that into account here. When
+     using VFP, word order of doubles follows byte order. */
+
+#define SWAP_DOUBLE(a)    (((a) << 32) | (((a) >> 32) & 0x00000000ffffffff))
+
+  val.j = SWAP_DOUBLE(val.j);
+#endif
+
   e = val.j & 0x7ff0000000000000LL;
   f = val.j & 0x000fffffffffffffLL;
 
@@ -148,6 +158,10 @@ Java_java_lang_VMDouble_doubleToRawLongB
 
   val.d = doubleValue;
 
+#if defined(__IEEE_BYTES_LITTLE_ENDIAN)
+  val.j = SWAP_DOUBLE(val.j);
+#endif
+
   return val.j;
 }
 
@@ -165,6 +179,10 @@ Java_java_lang_VMDouble_longBitsToDouble
 
   val.j = longValue;
 
+#if defined(__IEEE_BYTES_LITTLE_ENDIAN)
+  val.j = SWAP_DOUBLE(val.j);
+#endif
+
   return val.d;
 }
 




More information about the Classpath-patches mailing list