Skip to content

Conversation

@benguild
Copy link
Contributor

@benguild benguild commented Dec 25, 2025

Title explains, I'll include comment(s) in the diff. I think this is correct (?) and tried to expand the tests as well, but please let me know if you see any issues.


// cellUnionDifferenceInternal adds (xid - y) to the CellUnion. It subdivides
// xid when there is partial overlap, narrowing y before recursing.
func (cu *CellUnion) cellUnionDifferenceInternal(xid CellID, y CellUnion) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved this prior to the exported method to match C++ and have better proximity.

var cu CellUnion
for _, xid := range x {
cu.cellUnionDifferenceInternal(xid, &y)
cu.cellUnionDifferenceInternal(xid, y)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seemed OK to pass by value

return
}

y = y[lo:hi]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By reducing the size of "y" we're narrowing the search in the call to "ContainsCellID" and in recursive calls.

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.

1 participant