On 2010-02-23, Carl <[email protected]> wrote:
> On Tue, 2010-02-23 at 23:08 +0000, Grant Edwards wrote:
>> The values being passed to printf and then displayed are
>> "unsigned".  On the '430, that's 16 bits.  On the PC that's 32
>> bits.
>
> A short on both my system and 430 is 16 bits. A long on both my system
> and the 430 are both 32 bits. I can inspect the memory with gdb. The
> problem is the upper 16 bits of y on the 430 are set. Why does it do
> this?
>
> On PC:
>
> (gdb) p sizeof(y)
> $1 = 4
> (gdb) p /x y
> $2 = 0x8000
>
> On 430:
>
> (gdb) p sizeof(y)
> $1 = 4
> (gdb) p /x y
> $2 = 0xffff8000

Unless you provide the code that was run up to that point,
there's no way to answer your question.

But, I suspect that on the msp430, the value in question was an
"int" at some point and then got converted to a long. 

On the MSP430, that resulted in the value being sign-extended
when it got converted from 16 to 32 bits.  On a PC, an "int"
and "long" are both 32 bits, so there is no sign extension when
a value is converted from an int to a long.

-- 
Grant Edwards                   grante             Yow! Am I having fun yet?
                                  at               
                               visi.com            


Reply via email to