MCPcopy Create free account
hub / github.com/Noumena-Network/code / findNextDiff

Function findNextDiff

src/ink/screen.ts:1581–1592  ·  view source on GitHub ↗

* 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,
)

Source from the content-addressed store, hash-verified

1579 * or `count` if all cells match. Tiny and pure for JIT inlining.
1580 */
1581function findNextDiff(
1582 a: Int32Array,
1583 b: Int32Array,
1584 w0: number,
1585 count: number,
1586): number {
1587 for (let i = 0; i < count; i++, w0 += 2) {
1588 const w1 = w0 | 1
1589 if (a[w0] !== b[w0] || a[w1] !== b[w1]) return i
1590 }
1591 return count
1592}
1593
1594/**
1595 * Diff one row where both screens are in bounds.

Callers 1

diffRowBothFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected