Skip to content

Commit

Permalink
bitshift is faster than division by 2
Browse files Browse the repository at this point in the history
  • Loading branch information
craigmayhew committed Mar 20, 2024
1 parent 0a43945 commit f263466
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/pages/primalitytest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ fn sprp(n: u64, a: u64) -> bool {
if d % 2 == 1 {
break;
}
d /= 2;
d >>= 1;
s += 1;
}
// Now n-1 = d*2^s with d odd
Expand Down

0 comments on commit f263466

Please sign in to comment.