[Top][All Lists]

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

Re: [Pnet-developers] CVMWord union and ReadLong Int32/Int64 mismatch?

From: Rhys Weatherley
Subject: Re: [Pnet-developers] CVMWord union and ReadLong Int32/Int64 mismatch?
Date: Fri, 24 Sep 2004 11:30:01 +1000
User-agent: KMail/1.4.3

On Friday 24 September 2004 11:18 am, Peter Colson wrote:
> In cvm.c, the function 'ReadLong' (where long presumably means an
> integral type) is assumed to be an Int64
> taken from the same union above that only contains Int32 integrals:

Int64 quantities may occupy 1 or 2 stack words, depending upon the platform 
size/alignment rules.  Adding a "ILInt64" field to the CVMWord union would 
cause stack slots to expand to 64 bits on all platforms, wasting space on 
those (like x86) that don't need 64-bit alignment of 64-bit values.

The "IL_BEST_ALIGNMENT" macro will normally pad the union to the correct 
boundary to prevent mis-aligned accesses on picky platforms.

> I don't understand the Int32/Int64 mismatch here?

The "ReadLong" function is not taking a pointer to 1 stack word.  It is taking 
a pointer to the stack word containing the beginning of the value.  The value 
may extend into the following stack words on some platforms.



P.S. Wouldn't it be easier to simply migrate your customers off the 
bletcherous AS/400 onto a real hardware platform and operating system? :-)

reply via email to

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