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

Re: [bluetooth-dev] Re: Porting to ARM



On Wed, 27 Sep 2000, Erwin Authried wrote:
> The bluetooth packets are big-endian, thus the ntoh* functions are not usable.

Ok.. typical :)

> The macros cpu_to_le* and le*_to_cpu from the kernel headers seem 
> to do the right job. Using some clever assember inline codes isn't 
> necessary. The ARM compiler, at least, produces much better code
> with the simple, architecture independent definitions together with 
> packed variable access. That's because the optimizer fetches the bytes
> in the needed order. With the assembler version, the optimizer has
> no chance to do this because the assembler instructions "insist" on 
> the byte swapping, and can't be optimized away.

Yeah for the ARM case. But the other little-endian archs have the "clever
assembler inline" in the cpu_to_le* macros. I think it also has to do with
the fact that ARM needs a _very_ costly swap operation (no swap
instruction it seems) so if you're going to do bytereads you might as well
try to embed it in them (as you wrote).

Maybe we should redefine them as btohl/htobl instead
(s/network/bluetooth) :)

-Bjorn