Thread (1 message) 1 message, 1 author, 2003-07-18

Re: need a fast byteorder changing routine

From: Wojciech Kromer <hidden>
Date: 2003-07-18 06:26:34

Użytkownik li napisał:
Hi all,
i need do a lot of byteorder changing operation from big-endian to little-endian. cpu_to_le32 is 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
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:krom@dgt-lab.com.pl


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help