Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the difference method on bit vectors #4546

Merged
merged 1 commit into from Jan 20, 2013

Conversation

@alexcrichton
Copy link
Member

alexcrichton commented Jan 20, 2013

I was looking into the difference method on the bit vector implementations, and I found that it didn't quite align with what I thought of as the difference between two sets.

For SmallBitv, the difference was just the xor of the two vectors, which I'm not really sure what it's supposed to represent. For BigBitv, it almost did the difference except that it added in lots of bits which weren't related to the two bit vectors.

I figured that the difference method should return the set-wise difference:

A / B = { x : x in A and x not in B }

so I updated both of the difference methods to do that and added some tests to do that. If this isn't right, the two implementations (SmallBitv/BigBitv) appear to do different things, so they should probably be unified to one thing anyway.

@thestinger

This comment has been minimized.

Copy link
Contributor

thestinger commented Jan 20, 2013

+1, xor is equivalent to the symmetric difference rather the difference

@catamorphism

This comment has been minimized.

Copy link
Contributor

catamorphism commented Jan 20, 2013

This was my fault. Thanks!

catamorphism added a commit that referenced this pull request Jan 20, 2013
Fix the difference method on bit vectors
@catamorphism catamorphism merged commit 1cfa01d into rust-lang:incoming Jan 20, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.