in-place bit-reversed shuffle on an array
问题 For a FFT function I need to permutate or shuffle the elements within an array in a bit-reversed way. That's a common task with FFTs because most power of two sized FFT functions either expect or return their data in a bit-reversed way. E.g. assume that the array has 256 elements I'd like to swap each element with it's bit-reversed pattern. Here are two examples (in binary): Element 00000001b should be swapped with element 10000000b Element 00010111b should be swapped with element 11101000b