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
rts
$ m68k-atari-mint-gcc -S a.c -o - -O2 -fomit-frame-pointer -mshort
#NO_APP
.text
.even
.globl _rotate
_rotate:
move.w 4(%sp),%d0
move.w 6(%sp),%d1
rol.w %d1,%d0
rts
And the function is even inlined when it is used in the same source.
How wrong I was when saying this was a suboptimal case !
--
Vincent Rivière