[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnet/engine box.c,1.2,1.3 lib_reflect.c,1.30
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnet/engine box.c,1.2,1.3 lib_reflect.c,1.30,1.31 |
Date: |
Thu, 06 Mar 2003 18:48:56 -0500 |
Update of /cvsroot/dotgnu-pnet/pnet/engine
In directory subversions:/tmp/cvs-serv29741/engine
Modified Files:
box.c lib_reflect.c
Log Message:
Handle "float" and "double" return values correctly when they are expected
to "native float" internally.
Index: box.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/box.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** box.c 4 Jun 2002 03:23:22 -0000 1.2
--- box.c 6 Mar 2003 23:48:53 -0000 1.3
***************
*** 55,58 ****
--- 55,98 ----
}
+ ILObject *ILExecThreadBoxFloat(ILExecThread *thread, ILType *type, void *ptr)
+ {
+ ILClass *classInfo;
+ ILObject *object;
+ ILUInt32 typeSize;
+ if(ILType_IsPrimitive(type) || ILType_IsValueType(type))
+ {
+ classInfo = ILClassFromType
+ (ILContextNextImage(thread->process->context, 0),
+ 0, type, 0);
+ if(!classInfo)
+ {
+ ILExecThreadThrowOutOfMemory(thread);
+ return 0;
+ }
+ typeSize = ILSizeOfType(thread, type);
+ object = (ILObject *)_ILEngineAlloc(thread, classInfo,
typeSize);
+ if(object)
+ {
+ if(type == ILType_Float32)
+ {
+ *((ILFloat *)object) =
(ILFloat)(*((ILNativeFloat *)ptr));
+ }
+ else if(type == ILType_Float64)
+ {
+ *((ILDouble *)object) =
(ILDouble)(*((ILNativeFloat *)ptr));
+ }
+ else
+ {
+ ILMemCpy(object, ptr, typeSize);
+ }
+ }
+ return object;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
int ILExecThreadUnbox(ILExecThread *thread, ILType *type,
ILObject *object, void *ptr)
***************
*** 63,66 ****
--- 103,133 ----
{
ILMemCpy(ptr, object, ILSizeOfType(thread, type));
+ return 1;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ int ILExecThreadUnboxFloat(ILExecThread *thread, ILType *type,
+ ILObject *object, void *ptr)
+ {
+ if(object && ptr &&
+ (ILType_IsPrimitive(type) || ILType_IsValueType(type)) &&
+ ILTypeIdentical(type, ILClassToType(GetObjectClass(object))))
+ {
+ if(type == ILType_Float32)
+ {
+ *((ILNativeFloat *)ptr) = (ILNativeFloat)(*((ILFloat
*)object));
+ }
+ else if(type == ILType_Float64)
+ {
+ *((ILNativeFloat *)ptr) = (ILNativeFloat)(*((ILDouble
*)object));
+ }
+ else
+ {
+ ILMemCpy(ptr, object, ILSizeOfType(thread, type));
+ }
return 1;
}
Index: lib_reflect.c
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/engine/lib_reflect.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -r1.30 -r1.31
*** lib_reflect.c 10 Jan 2003 00:44:11 -0000 1.30
--- lib_reflect.c 6 Mar 2003 23:48:53 -0000 1.31
***************
*** 1753,1758 ****
{
/* Unbox primitive and enumerated types into
the argument */
! if(!ILExecThreadUnbox(thread, objectType,
paramObject,
!
&(args[argNum])))
{
ILExecThreadThrowSystem
--- 1753,1758 ----
{
/* Unbox primitive and enumerated types into
the argument */
! if(!ILExecThreadUnboxFloat
! (thread, objectType,
paramObject, &(args[argNum])))
{
ILExecThreadThrowSystem
***************
*** 1851,1855 ****
return 0;
}
! return ILExecThreadBox(thread, ILTypeGetReturn(signature),
&result);
}
else if(ILType_IsClass(paramType))
--- 1851,1856 ----
return 0;
}
! return ILExecThreadBoxFloat
! (thread, ILTypeGetReturn(signature), &result);
}
else if(ILType_IsClass(paramType))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnet/engine box.c,1.2,1.3 lib_reflect.c,1.30,1.31,
Rhys Weatherley <address@hidden> <=