"wax wacky" <[EMAIL PROTECTED]> a écrit dans le message de
news:[EMAIL PROTECTED]
>
> I am confused by the behaviour of my code warrior ..... my problem is
>
> in my program i have an assignment
>
> UInt32 qqq;
> qqq = (aiRows * aiColumns * 4); ///aiRows = 160, aiCloumns = 140 ;
>
> Now the problem : after execution qqq gets a value of 24064 (binary : 0101
1110 0000 0000 ) instead of 89600 (binary: 1 0101 1110 0000 0000)
>
> That means the operation (aiRows * aiColumns * 4) is giving only a 16 bit
value.
>

The compiler use the biggest data type on the right side of the equation.
The fact that the result is sended to a UInt32 does not tell the compiler to
use UInt32 in its computation.
Use 4L to force the value to be long, or use a type cast like:
(UInt32)aiRows.

-- 
Regis St-Gelais
www.laubrass.com
--



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to