Skip to content

Commit

Permalink
Update testQuasiLinearGCD.py: branchless
Browse files Browse the repository at this point in the history
  • Loading branch information
daedalus committed Feb 12, 2024
1 parent cd0272a commit 616a135
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions testQuasiLinearGCD.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,11 @@ def SeqMult1(x, y):

factors = []
for i in range(0, len(j)):
if i % 2 != 0:
factor = GCD(k[i], r[(i + 1) / 2] * k[i + 1])
else:
factor = GCD(k[i], r[i / 2] * k[i - 1])
#if i & 1 == 1:
# factor = GCD(k[i], r[(i + 1) >> 1] * k[i + 1])
#else:
# factor = GCD(k[i], r[i >> 1] * k[i - 1])
factor = GCD(k[i], r[(i + (i & 1)) >> 1] * k[i + (-1) ** ((i + 1) & 1)])
factors.append(factor)
return factors

Expand Down

0 comments on commit 616a135

Please sign in to comment.