Skip to content

fix InsertAt corrupting first word in some cases - #240

Merged
lemire merged 1 commit into
bits-and-blooms:masterfrom
whisk:fix/InsertAt
Oct 31, 2026
Merged

lemire merged 1 commit into
bits-and-blooms:masterfrom
whisk:fix/InsertAt

Conversation

@whisk

@whisk whisk commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Problem

InsertAt can corrupt bits in the first word when inserting to positions in word 2 or beyond. That was very difficult to catch even with massive fuzzing.

b2 := New(0).Set(9) // 1st word
b2.InsertAt(64)     // 2nd word
b2.Test(9) // FALSE, expected to be TRUE

Fix

A good simplification of InsertAt was the use of extendSet and covering an edge case when idx > length.

@lemire
lemire merged commit 172b3d0 into bits-and-blooms:master Oct 31, 2026
35 checks passed
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.

2 participants