Helmut Karlowski wrote:
Am 09.12.2009, 18:08 Uhr, schrieb Vincent Rivière <vincent.riviere@freesbee.fr>:Andreas Schwab wrote:unsigned int rotate (unsigned int a, int n) { return (a << n) | (a >> (sizeof (a) * 8 - n)); }Correct ! $ m68k-atari-mint-gcc -S a.c -o - -O2 -fomit-frame-pointer #NO_APP .text .even .globl _rotate _rotate: move.l 4(%sp),%d0 move.l 8(%sp),%d1 rol.l %d1,%d0 rtsWow! This is surprising, what does AHCC do on this? I won't post the pure-c code here ...
Dont expect anything better :-) AHCC is just a simple guy. However, if a rotate function was really important for a application, I would give you a binary operator a __rotate__ n and a macro that makes it look like a function. That will cost me an hour. I wouldnt even try to guess how man years are spent on the optimation capabilities of GCC to achieve the above result. I'll do it tomorrow, just for fun. Before lunch. -- Groeten; Regards. Henk Robbers. http://members.chello.nl/h.robbers Interactive disassembler: TT-Digger; http://digger.atari.org A Home Cooked C compiler: AHCC; http://ahcc.atari.org