[Top][All Lists]

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

Re: [avr-gcc-list] dev and mod may not be optimized

From: Gre7g Luterman
Subject: Re: [avr-gcc-list] dev and mod may not be optimized
Date: Tue, 11 Dec 2007 15:56:06 -0800 (PST)

--- "Dmitry K." <address@hidden> wrote:
> Alas, the usage of div() function is more space and
> more time
> expansive. The reason is that div() uses an another
> function:
> __divmodhi4(), i.e. 16-bits.
> Compare two programs:
>   prog1:  150 bytes, 238 clocks
>   prog2:  212 bytes, 316 clocks

Well if size & speed are getting you down, try this:


The calculation takes 22 bytes and executes in 40
clocks.  As an assembly-language programmer, having
that extra MOV in the beginning annoys me, but hey, I
try not to break the asm rules.

Regardless, you'd be hard-pressed to get it much
smaller or faster.



Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

reply via email to

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