[Top][All Lists]

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

RE: [avr-gcc-list] Operation problem

From: Eric Weddington
Subject: RE: [avr-gcc-list] Operation problem
Date: Thu, 09 Aug 2007 17:38:07 -0600

> -----Original Message-----
> From:
> address@hidden
> [mailto:address@hidden
> org] On Behalf Of Gerard Marull Paretas
> Sent: Thursday, August 09, 2007 2:16 PM
> To: address@hidden
> Subject: [avr-gcc-list] Operation problem
> Hello.
> When I try to execute this line:
> currentsong.length=(currentsong.frames *
> currentsong.samples_per_frame) / currentsong.samples_per_sec;
> currentsong.length gets no result. However, doing these
> operations step by step produce the expected results:
> currentsong.length=currentsong.frames;
> currentsong.length*=currentsong.samples_per_frame;
> currentsong.length/=currentsong.samples_per_sec;
> The second method requires currentsong.length to be a long
> int (uint32_t), because the multiplication of
> currentsong.frames by currentsong.samples_per_frame does not
> fit on an uint16_t. But with the first way, an uint16_t would
> be enough, since never will reach values over uint16_t limit.
> All other used variables are uint16_t.
> I don't know what could be the problem. Maybe I'm missing something ?

Please provide more context than just these snippets. What types are the
original variables? Can you show us the assembly output from the compiler?

Eric Weddington

reply via email to

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