in-place bit-reversed shuffle on an array

前端 未结 7 1343
后悔当初
后悔当初 2020-12-05 08:50

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 fun

7条回答
  •  情话喂你
    2020-12-05 09:47

    Using a pre-built lookup table to do the mapping seems to be the obvious solution. I guess it depends how big the arrays you will be dealing with are. But even if a direct mapping is not possible, I'd still go for a lookup table, maybe of byte-size patterns that you can use to build the word-sized pattern for the final index.

提交回复
热议问题