Re: Reverse (Mirror) Binary Number

Arne Vajhøj <arne@xxxxxxxxxx> wrote:

Colmeister wrote:
This should be a simple task but I seem to be having a brain-block at the

I have a 6 bit number (0 - 63) that I need to reverse at the binary level,

If the starting number is 5
The binary representation is 000101
The reversed binary representation is 101000
The result (which I need to be able to calculate) is 40

I can do this by converting the number to a string (or char array)
representation of the binary number, reversing it, and then converting back
to a number, but there must be a better method.

I would use a lookup table with 64 elements.

Absolutely. That's the way most FFT routines solve this problem.
Tim Roberts, timr@xxxxxxxxx
Providenza & Boekelheide, Inc.