The fastest way to do bit reversal in a micro that does not have a specific instruction (like most DSP's have) is via a lookup table. In your case, this table would require 256 locations. As far as I know, bit reversal is really only useful for FFT's during the butterfly addressing, so I guess you need this for a 256 bin FFT.
Cheers Harry Home office phone (03) 9504 1957 hlemm...@optushome.com.au -----Original Message----- From: mspgcc-users-ad...@lists.sourceforge.net [mailto:mspgcc-users-ad...@lists.sourceforge.net]on Behalf Of Georg Ritter Sent: Thursday, January 22, 2004 9:09 PM To: mspgcc-users@lists.sourceforge.net Subject: [Mspgcc-users] bit reverse byte fn() Good morning! I'm looking for a proper implementation of a bitwisereverse function of a byte (1010 0001 becomes: 1000 0101). I want to replace an ugly and clumpsy function I used in testing. I would like to write smth like: unsigned char reverse(unsigned char b) { unsigned char tmp=0; for( i=0; i<8; i++ ) { // RRC.B of b // RRL.B into tmp } return tmp; } There's no real "C" way of doing it, isn't it? So what could the inline asmbly line for that look like. I never used it before, and it's tricky and documents didn't enlighten my too much. So my versions either didn't compile or didn't work. Or is there a smaller (in terms of code size) way of doing the reversion (hacker contest ;-) )? Greetz, Georg ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users