Re: copy-bit macro

Alan Cox (alan@lxorguk.ukuu.org.uk)
Tue, 9 Dec 1997 09:07:11 +0000 (GMT)


> Withot having to define bit-shift amounts, GCC nicely optimizes that
> into, e.g.
> movl %edx,%eax
> sall $17,%eax
> andl $16777216,%eax
> orl %eax,%ecx
>
> Might such a copy_bit macro be a useful general kernel utility?
> I know Linus hates slow code, and a jump is slower than just about
> anything.

Have you given the egcs people this code as an example. Ultimately gcc
should be generating the above patterns for the code rather than human
written hacks.

In the mean time copy_bits sounds good