[Top][All Lists]

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

[avr-gcc-list] Operation problem

From: Gerard Marull Paretas
Subject: [avr-gcc-list] Operation problem
Date: Thu, 9 Aug 2007 22:16:17 +0200


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:


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 ?

Thanks, Gerard.

reply via email to

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