need a fast byteorder changing routine
Quoted 14 lines · Użytkownik li
Hi all,
i need do a lot of byteorder changing operation from big-endian to little-endian.cpu_to_le32is not fast enough for me, does anyone have such a routine written in asm.?
PS: here is an ugly asm function do such thing:
void swapbyte(unsigned long *val, unsigned long offset,
unsigned long value)
{asm ("lis 3 %0@ha" : "=r" (val)); asm ("lwz 3,%0@l(3)" : "=r" (val)); asm ("stw %1, 0(4)" : "=r" (offset)); asm ("stw %2, 0(5)" : "=r" (value)); asm ("stwbrx 5, 3, 4"); }val is the address of value. i used to set this function as inline, but kernel said: Oops: kernel access of bad area, sig: 11
Quoted 8 lines
Any comments
Best Regards!
Li
try DIRECT using out_le16/32 in_le16/32 from <asm/io.h>, this takes same time as one big endian write/read
--
* * * * * * * * * * * *
* per pedes ad astra! *
* * * * * * * * * * * * mailto:[email protected]
** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/