avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] Multiply is broken on Mega128 (was: Problem with sign


From: Volkmar Dierkes
Subject: Re: [avr-gcc-list] Multiply is broken on Mega128 (was: Problem with signed 32bit ints?) a better test case
Date: Wed, 29 Jan 2003 23:17:57 +0100
User-agent: 40tude_Dialog/2.0.3.1 Hamster/2.0.0.0

Mike,

it works, if you use correct type conversion.

Your code:
>       for (i=0; i < T8x16SIZE; i++)
>       {
>               x = t8x16[i].a * t8x16[i].b;
>               y = t8x16[i].x;

Better:
>               x = (int32_t) t8x16[i].a * t8x16[i].b;
>               y = t8x16[i].x;

Try it.

Even you think, why shall I do such things, the compiler should do 
that. No, you have to define exact, what you want. The compiler 
can't know what you want. And, if you using explicit casting, the 
code is easier to understand. If you don't use a naming convention 
than you didn't know the type of the variables (after some time). 
And even with such naming, use the casting.

Volkmar
avr-gcc-list at http://avr1.org



reply via email to

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