[noparse]
<html>k, b, a = 0, N>>1, 1<br>
while b >= a:<br>
if b & i: k = k | a<br>
if a & i: k = k | b<br>
b, a = b>>1, a<<1</html>
[/noparse]

save that as a .html and open it in a browser, gives

k, b, a = 0, N>>1, 1
while b >= a:
if b & i: k = k | a
if a & i: k = k | b
b, a = b>>1, a<<1

# 6.2 bitrev()
#
# Summary
# Return bit-reversed array for FFT
# Usage
# list = bitrev(list)
"""
Return bit-reversed list, whose length is assumed to be 2^n:
eg. 0111 <--> 1110 for N=2^4.
"""
def bitrev(x):
N, x = len(x), x[:]
if N != nextpow2(N): raise ValueError, 'N is not power of 2'
for i in range(N):
k, b, a = 0, N>>1, 1
while b >= a:
if b & i: k = k | a
if a & i: k = k | b
b, a = b>>1, a<<1
if i < k: # important not to swap back
x[i], x[k] = x[k], x[i]
return x