Skip to content

Commit 45d58d2

Browse files
committedJul 19, 2022
Small cleanup
1 parent 6c5236b commit 45d58d2

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed
 

‎mod.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,17 @@ const myers_x = (b: string, a: string) => {
5555
}
5656
for (let i = 0; i < n; i++) {
5757
const eq = peq[a.charCodeAt(i)];
58-
const pb = (phc[(i / 32) | 0] >>> i % 32) & 1;
59-
const mb = (mhc[(i / 32) | 0] >>> i % 32) & 1;
58+
const pb = (phc[(i / 32) | 0] >>> i) & 1;
59+
const mb = (mhc[(i / 32) | 0] >>> i) & 1;
6060
const xv = eq | mv;
6161
const xh = ((((eq | mb) & pv) + pv) ^ pv) | eq | mb;
6262
let ph = mv | ~(xh | pv);
6363
let mh = pv & xh;
6464
if ((ph >>> 31) ^ pb) {
65-
phc[(i / 32) | 0] ^= 1 << i % 32;
65+
phc[(i / 32) | 0] ^= 1 << i;
6666
}
6767
if ((mh >>> 31) ^ mb) {
68-
mhc[(i / 32) | 0] ^= 1 << i % 32;
68+
mhc[(i / 32) | 0] ^= 1 << i;
6969
}
7070
ph = (ph << 1) | pb;
7171
mh = (mh << 1) | mb;
@@ -86,19 +86,19 @@ const myers_x = (b: string, a: string) => {
8686
let score = m;
8787
for (let i = 0; i < n; i++) {
8888
const eq = peq[a.charCodeAt(i)];
89-
const pb = (phc[(i / 32) | 0] >>> i % 32) & 1;
90-
const mb = (mhc[(i / 32) | 0] >>> i % 32) & 1;
89+
const pb = (phc[(i / 32) | 0] >>> i) & 1;
90+
const mb = (mhc[(i / 32) | 0] >>> i) & 1;
9191
const xv = eq | mv;
9292
const xh = ((((eq | mb) & pv) + pv) ^ pv) | eq | mb;
9393
let ph = mv | ~(xh | pv);
9494
let mh = pv & xh;
95-
score += (ph >>> ((m % 32) - 1)) & 1;
96-
score -= (mh >>> ((m % 32) - 1)) & 1;
95+
score += (ph >>> (m - 1)) & 1;
96+
score -= (mh >>> (m - 1)) & 1;
9797
if ((ph >>> 31) ^ pb) {
98-
phc[(i / 32) | 0] ^= 1 << i % 32;
98+
phc[(i / 32) | 0] ^= 1 << i;
9999
}
100100
if ((mh >>> 31) ^ mb) {
101-
mhc[(i / 32) | 0] ^= 1 << i % 32;
101+
mhc[(i / 32) | 0] ^= 1 << i;
102102
}
103103
ph = (ph << 1) | pb;
104104
mh = (mh << 1) | mb;

0 commit comments

Comments
 (0)
Please sign in to comment.