----- Original Message ----- 
From: "Georg Ritter" <new...@gamebox.net>
To: <mspgcc-users@lists.sourceforge.net>
Sent: Thursday, January 22, 2004 10:09 AM
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 ;-) )?

A look up table is fastest, but takes a lot more space.

Leon
--
Leon Heller, G1HSM
Email: aqz...@dsl.pipex.com
My low-cost Philips LPC210x ARM development system:
http://www.geocities.com/leon_heller/lpc2104.html

Reply via email to