natDouble.java (doubleToLongBits): ensure that all NaNs are always converted to the same long value.

1999-04-14  Andrew Haley  <aph@cygnus.com>
        * java/lang/natDouble.java (doubleToLongBits): ensure that all
        NaNs are always converted to the same long value.
        * java/lang/natFloat.java (floatToIntBits): ditto, but for float
        converted to int.

From-SVN: r26439
This commit is contained in:
Andrew Haley 1999-04-14 07:10:22 +00:00 committed by Andrew Haley
parent 2de45c0679
commit 2b37afcb36
3 changed files with 20 additions and 0 deletions

View File

@ -1,3 +1,10 @@
1999-04-14 Andrew Haley <aph@cygnus.com>
* java/lang/natDouble.java (doubleToLongBits): ensure that all
NaNs are always converted to the same long value.
* java/lang/natFloat.java (floatToIntBits): ditto, but for float
converted to int.
1999-04-13 Tom Tromey <tromey@cygnus.com>
* java/lang/natSystem.cc (arraycopy): Don't always use jbyteArray;

View File

@ -47,6 +47,13 @@ java::lang::Double::doubleToLongBits(jdouble value)
{
union u u;
u.d = value;
jlong e = u.l & 0x7ff0000000000000LL;
jlong f = u.l & 0x000fffffffffffffLL;
if (e == 0x7ff0000000000000LL && f != 0L)
u.l = 0x7ff8000000000000LL;
return u.l;
}

View File

@ -24,6 +24,12 @@ java::lang::Float::floatToIntBits(jfloat value)
{
union u u;
u.d = value;
jint e = u.l & 0x7f800000;
jint f = u.l & 0x007fffff;
if (e == 0x7f800000 && f != 0)
u.l = 0x7fc00000;
return u.l;
}