Skip to content

Remove redundant length check in sameArray1#591

Merged
sjakobi merged 1 commit into
masterfrom
sjakobi/sameArray1-no-length-check
Jun 4, 2026
Merged

Remove redundant length check in sameArray1#591
sjakobi merged 1 commit into
masterfrom
sjakobi/sameArray1-no-length-check

Conversation

@sjakobi

@sjakobi sjakobi commented Jun 4, 2026

Copy link
Copy Markdown
Member

Summary

Removes the upfront lenxs /= lenys length check from sameArray1 and documents a precondition that callers pass equal-length arrays.

Both call sites only compare arrays already known to be equal length:

  • BitmapIndexed comparisons are guarded by bm1 == bm2 → equal popCount → equal array length (INV4).
  • Full nodes always hold exactly maxChildren sub-nodes (INV8).

Fixes #465.

Both call sites (equal1 and equalKeys) only compare arrays whose lengths
are already known to be equal: BitmapIndexed comparisons are guarded by
equal bitmaps (equal popCount, hence equal array length), and Full nodes
always hold maxChildren elements.

Fixes #465.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@sjakobi
sjakobi marked this pull request as ready for review June 4, 2026 08:39
@sjakobi
sjakobi merged commit 1873009 into master Jun 4, 2026
11 checks passed
@sjakobi
sjakobi deleted the sjakobi/sameArray1-no-length-check branch June 4, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Length check in sameArray1 is redundant

2 participants