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

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

[avr-gcc-list] optimzed division ?


From: Eckhard Tikwinski
Subject: [avr-gcc-list] optimzed division ?
Date: Thu, 19 Apr 2001 19:13:21 +0200

Hi everyone,

is it a bug or is it a feature ?
I tried with gcc 2.97 and -O2:

int x;
x=0x7FFF;
x=x div 2; // will be optimized to shift

The generated code will increment x first if 
positive. Then it does an arithmetic shift. For 
x=0x7FFF the result will be 0xC000. Maybe this 
was inteded to do some kind of rounding.

Thanks,

Eckhard Tikwinski
address@hidden



reply via email to

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