none
How INT_PTR datatype works between 64Bit and 32Bit

    Question

  • Hi

    I would like to know a bit more information on INT_PTR data type working.

    Since INT_PTR is a precision pointer data type and it takes size of 8 bytes in 64 bit and 4 bytes in 32 bit correspondingly,

    suppose during the serialization process, if i have to serialize the INT_PTR data type between 64 bit and 32bit, then how does it works.

    Example:

    CArray<int*, int*>arrTest;

     

    Write : ar << arrTest.GetSize()

    Read :

    INT_PTR nCount = arrTest.GetSize()

    ar >> nCount

     

    Now if i have save the data in 64bit project ( Write Operation ) and going to read that data which will be a project file in my case ( Read Operation), how does INT_PTR data type works.

    How is byte shifting or data truncation handled between the two platforms by these pointer precision data types ?

     

    Regards

    Anur RS

    Friday, May 07, 2010 12:44 AM

Answers

  • When converting 32-bit to 64-bit, signed number are sign extended and unsigned numbers are 0 extended.

    Sign extension means filling the high order bytes with what ever value is in the sign bit.

    Zero extension means filling the high order bytes with zeros.

    Truncation only means removing the high order bytes.


    «_Superman_»
    Microsoft MVP (Visual C++)
    Friday, May 07, 2010 2:02 AM