dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: RE: Optimized bitswap
From: Nielsen Linus (ext) (
Date: 2002-08-20

I just tried it, and it wasn't entirely correct.

It swapped from start+2 thru start+len*2 inclusive, when it should swap from
start thru start+len*2-2.

I took the liberty of correcting your (really good) code and made the loop
go forward in memory. And i also committed it to the CVS.

And guess what? It seems to be even FASTER than the 16-bit version! :-)

Nice work, Magnus!


> I managed to fixed it, so I've attached my bitswap function.
> Both code and the flipdata array resides in the internal RAM.
> I've been using it a little while now, and it seems to be OK
> - or maybe not: I just heard an audio glitch. So more testing
> is probably needed. :)
> As for using it: add bitswap.S to the makefile and remove
> bitswap() (but leave a declaration for it),
> create_fliptable(), fliptable[] and big_fliptable[] from mpeg.c.
> Interesting detail: for the flipping to work properly
> (without audio glitches) I had to make it work from the end
> of the buffer, just like the C code...
> > You have to save all registers from r8 and up.
> Luckily I only use r0-r7. :)
> Magnus

Page was last modified "Jan 10 2012" The Rockbox Crew