* Scan for the next cell that differs between two Int32Arrays. * Returns the number of matching cells before the first difference, * or `count` if all cells match. Tiny and pure for JIT inlining.
( a: Int32Array, b: Int32Array, w0: number, count: number, )
| 1211 | * or `count` if all cells match. Tiny and pure for JIT inlining. |
| 1212 | */ |
| 1213 | function findNextDiff( |
| 1214 | a: Int32Array, |
| 1215 | b: Int32Array, |
| 1216 | w0: number, |
| 1217 | count: number, |
| 1218 | ): number { |
| 1219 | for (let i = 0; i < count; i++, w0 += 2) { |
| 1220 | const w1 = w0 | 1 |
| 1221 | if (a[w0] !== b[w0] || a[w1] !== b[w1]) return i |
| 1222 | } |
| 1223 | return count |
| 1224 | } |
| 1225 | |
| 1226 | /** |
| 1227 | * Diff one row where both screens are in bounds. |