*** Field.c Mon Jul 26 16:33:03 1999 --- /net/user/mgd/Field.c Wed Aug 11 19:53:37 1999 *************** *** 37,42 **** --- 37,60 ---- #include #include "defs.h" + static double + derefDouble (const void *p) + { + #if 1 + double val; + unsigned *ptr = (unsigned *) &val; + unsigned temp; + + memcpy (ptr, p, sizeof (double)); + temp = ptr[0]; + ptr[0] = ptr[1]; + ptr[1] = temp; + return val; + #else + return *(double *) p; + #endif + } + static char* getFieldAddress(Hjava_lang_reflect_Field* this, struct Hjava_lang_Object* obj) *************** *** 110,116 **** return execute_java_constructor(0,javaLangFloatClass,"(F)V",*(jfloat*)base); } else if ( fld->type == _Jv_doubleClass ) { ! return execute_java_constructor(0,javaLangDoubleClass,"(D)V",*(jdouble*)base); } else { /* If fld->type isn't one of the above then it's either a --- 128,135 ---- return execute_java_constructor(0,javaLangFloatClass,"(F)V",*(jfloat*)base); } else if ( fld->type == _Jv_doubleClass ) { ! return execute_java_constructor(0,javaLangDoubleClass,"(D)V", ! derefDouble (base)); } else { /* If fld->type isn't one of the above then it's either a *************** *** 295,300 **** --- 314,320 ---- } } + jdouble java_lang_reflect_Field_getDouble(struct Hjava_lang_reflect_Field* this, struct Hjava_lang_Object* obj) { *************** *** 307,313 **** base = getFieldAddress(this, obj); if ( fld->type == _Jv_doubleClass ) { ! return *(jdouble*)base; } else if ( fld->type == _Jv_floatClass ) { return (jdouble)(*(jfloat*)base); --- 327,333 ---- base = getFieldAddress(this, obj); if ( fld->type == _Jv_doubleClass ) { ! return derefDouble (base); } else if ( fld->type == _Jv_floatClass ) { return (jdouble)(*(jfloat*)base); *************** *** 567,573 **** } if ( fld->type == _Jv_doubleClass ) { ! *(jdouble*)base = val; } else { SignalError("java.lang.IllegalArgumentException", ""); --- 587,594 ---- } if ( fld->type == _Jv_doubleClass ) { ! ((unsigned *) base)[0] = ((unsigned *) &val)[1]; ! ((unsigned *) base)[1] = ((unsigned *) &val)[0]; } else { SignalError("java.lang.IllegalArgumentException", "");