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

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

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


From: Albert Andras
Subject: Re: [avr-gcc-list] dev and mod may not be optimized
Date: Tue, 11 Dec 2007 17:16:58 +0200

----- Original Message -----
From: "Nathan Moore" <address@hidden>
> unsigned char a, b, c;
> c = some_input_function();
> LABEL:
> a = c/10;
> b = c%10;
> ...
>
> *****************************************
> LABEL:
> mov r24,r18
> ldi r22,lo8(10)
> call __udivmodqi4
> mov r19,r24
> .LM436:
> mov r24,r18
>  call __udivmodqi4
>
> If I'm understanding __udivmodqi4 it produces the results of both of
> these with one call. 
Acording to:
http://www.nongnu.org/avr-libc/user-manual/structdiv__t.html
 
you could do:
 
div_t t;
t=div(c/10);
a=t.quot;
b=t.rem;
????
 
 
Andras

reply via email to

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