dotgnu-pnet
[Top][All Lists]
Advanced

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

Re: [Pnet-developers] Use of ILNativeUInt vs. unsigned long in pointer c


From: Rhys Weatherley
Subject: Re: [Pnet-developers] Use of ILNativeUInt vs. unsigned long in pointer casting and manipulation
Date: Fri, 24 Sep 2004 11:36:19 +1000
User-agent: KMail/1.4.3

On Friday 24 September 2004 11:40 am, Peter Colson wrote:

> OK. I just want to understand how the resultant pointer can be used as a
> real 'type' pointer in an environment that uses 8 byte pointers, if
> it's sourced from a 32 bit integral?

"ILType *" is not a pointer.  It is a pointer-sized union between 32-bit 
integers, class pointers, value type pointers, and complex types.  The 
low-order bits indicate which arm of the union is being used.  Essentially, 
it is the following structure, packed into one word:

struct
{
    int what_is_this : 2;
    union
    {
        ILInt32 element_type;
        ILClass *class_ptr;
        ILClass *value_type_ptr;
        ILComplexType *complex_ptr;
    };
};

It's a space-saving hack.  One which is too late to change.  If your platform 
cannot bit-pack into low-order bits, then it is time to get a new platform.  
It is that simple.

Cheers,

Rhys.



reply via email to

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