Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactoring code with Assign Multiple Targets #128

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -343,12 +343,7 @@ def FFT_bitreverse(N, data):
jj = j << 1
k = n >> 1
if i < j:
tmp_real = data[ii]
tmp_imag = data[ii + 1]
data[ii] = data[jj]
data[ii + 1] = data[jj + 1]
data[jj] = tmp_real
data[jj + 1] = tmp_imag
data[ii] , data[ii + 1] , data[jj] , data[jj + 1] = data[jj], data[jj + 1], data[ii], data[ii + 1]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I find that harder to read.

Copy link
Author

@idiomaticrefactoring idiomaticrefactoring Feb 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about adding a comment? it maybe more readable.
#swap two imaginary numbers with real part and imaginary part (data[ii],data[ii+1]) <->(data[jj],data[jj+1]) .

Yes, it maybe more longer making it seems harder read. How about if we first look at data[ii] to the left of “=”, then look at data[jj] to the right of “=”, then loop the operation? Sometimes, I find the original code have more statements making me a little scared and confused to read the code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is indeed harder to read and we should avoid changing benchmarks unless necessary, BTW the bytecode will now use unpack sequence rather than store name so will have an effect on its specialization.

while k <= j:
j -= k
k >>= 1
Expand Down