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

std: add pure functions to StaticBitSet #13770

Merged
merged 1 commit into from
Dec 5, 2022

Conversation

Pyrolistical
Copy link
Contributor

@Pyrolistical Pyrolistical commented Dec 4, 2022

I was surprised that StaticBitSet didn't implement subsetOf. Digging further I realized an entire set of pure functions could be added to StaticBitSet.

The following functions were added to both IntegerBitSet and ArrayBitSet:

fn eql(self: Self, other: Self) bool
fn subsetOf(self: Self, other: Self) bool
fn supersetOf(self: Self, other: Self) bool
fn complement(self: Self) Self
fn unionWith(self: Self, other: Self) Self
fn intersectWith(self: Self, other: Self) Self
fn xorWith(self: Self, other: Self) Self
fn differenceWith(self: Self, other: Self) Self

I am open to better function names.

DynamicBitSet remains unchanged as it is not possible to implement some of those functions without an allocator.

@Pyrolistical Pyrolistical changed the title std: added pure functions to StaticBitSet std: add pure functions to StaticBitSet Dec 4, 2022
The following functions were added to both IntegerBitSet and ArrayBitSet:
fn eql(self: Self, other: Self) bool
fn subsetOf(self: Self, other: Self) bool
fn supersetOf(self: Self, other: Self) bool
fn complement(self: Self) Self
fn unionWith(self: Self, other: Self) Self
fn intersectWith(self: Self, other: Self) Self
fn xorWith(self: Self, other: Self) Self
fn differenceWith(self: Self, other: Self) Self
@Vexu Vexu enabled auto-merge (rebase) December 5, 2022 15:05
@Vexu Vexu merged commit 9e74e4c into ziglang:master Dec 5, 2022
@Pyrolistical Pyrolistical deleted the bit-set-operators branch December 5, 2022 21:13
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