dotgnu-pnet
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pnet-developers] Use of ILNativeUInt vs. unsigned long in pointer casti


From: Peter Colson
Subject: [Pnet-developers] Use of ILNativeUInt vs. unsigned long in pointer casting and manipulation
Date: Wed, 22 Sep 2004 15:35:32 +1000

Greetings,

Having previously tried porting pnet to an environment that only supported 16 byte pointers that wouldn't allow casting and manipulation to/from integral types I now find myself in a later release of that environment that allows pointers to be represented as 8 byte entities that can be cast to/from integral types - in this case long long's.

All good so far.

However I've found differing instances in the pnet code of how this casting/manipulation is done.

Looking at engine/method_cache.c and it's Set/GetLeft/Right macros we see pointers being cast to ILNativeUInt's. This is good because the ILNative[U]Int typedefs resolve to 8 byte integrals.

In include/il_types.h, though, the various IL_TypeFrom/To macros use unsigned long as the intermediate type. This resolves to a 4 byte entity in my environment, so an obvious problem here.

When I look through the code I see other instances of, say, ILType_FromElement being used on a 'value' var that is returned as an unsigned long from ILMetaUncompressData().

My question is: How widespread is the use of unsigned long to hold/return pointers and wouldn't it be more portable to be using ILNativeUInt for this as per method_cache.c?

I'll keep reviewing the code, but am looking for a heads up from those with more widespread knowledge of the code.


Regards,
Peter Colson,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]