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

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

Re: [avr-gcc-list] Optimization for easy division


From: Torsten Hahn
Subject: Re: [avr-gcc-list] Optimization for easy division
Date: Fri, 12 Jul 2002 10:43:46 +0200

Am Freitag, 12. Juli 2002 01:44 schrieb Michael Tsao:
> Does avr-libc automatically turn this:
>
> uint8_t a = 8, b = 2, c = 0;
> c = a / b; /* slow */
>
> into this:
>
> uint8_t a = 8, b = 2, c = 0;
> c = a >> 1; /* fast */
>
> ?
>
> Or should I keep hardcoding shifts for speed as I've done much of my
> programming life?

Just look at the asembler output with

avr-objdump -D file.o

avr-libc makes exactly what you want, i think.

cu,
Torsten.
-- 
Torsten Hahn 
TU Bergakademie Freiberg - Institut für Experimentelle Physik 
Silbermannstraße 1, 09596 Freiberg
mail: address@hidden
phone: +49 3731 392670 
avr-gcc-list at http://avr1.org



reply via email to

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