Re: Reverse (Mirror) Binary Number
- From: Tim Roberts <timr@xxxxxxxxx>
- Date: Sat, 02 May 2009 12:03:23 -0700
Arne Vajhøj <arne@xxxxxxxxxx> 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.