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

BitSet enhancements #2131

Merged
merged 5 commits into from
Oct 29, 2020
Merged

BitSet enhancements #2131

merged 5 commits into from
Oct 29, 2020

Conversation

mikee47
Copy link
Contributor

@mikee47 mikee47 commented Oct 29, 2020

  • Make BitSet constexpr-compatible

    Allows construction of fixed values which may be used as pre-defined masks, e.g. FileOpenFlags.

  • Add size template parameter

    Primary use case is enumerated types which only use a subset of the Storage.
    For example, uint32_t can store 32 values but an enum may only have 15.
    Attempting to use ~ operator would produce an incorrect result without this information.

    Use this to provide domain() (set containing all values).

  • Add static asserts to check template parameters are compile time

  • Add methods to correspond with std::bitset

    Also tested and fixed for old compiler (linux)

  • Add page to framework docs

  • Add bitset module to HostTests for integration testing

  • Add toString support

* Make BitSet constexpr-compatible

Allows construction of fixed values which may be used as pre-defined masks,
e.g. FileOpenFlags.

* Add `size` template parameter

	Primary use case is enumerated types which only use a subset of the Storage.
For example, uint32_t can store 32 values but an enum may only have 15.
Attempting to use ~ operator would produce an incorrect result without this information.

Use this to provide `domain()` (set containing all values).

* Add static asserts to check template parameters are compile time

* Add methods to correspond with std::bitset

Also tested and fixed for old compiler (linux)

* Add page to framework docs

* Add bitset module to HostTests for integration testing
@slaff slaff added this to the 4.2.0 milestone Oct 29, 2020
{
value &= ~rhs.value;
value_ &= ~rhs.value_;
Copy link
Contributor

Choose a reason for hiding this comment

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

@mikee47 Please, remove leading or ending underscores.

Cannot have operator templates for non-BitSet values as they get picked up for other types and cause real problems.
Therefore need to add them explicitly if required. Is there a neater way to do this?

Require `extern toString` declaration as function may not have been declared yet.
@slaff
Copy link
Contributor

slaff commented Oct 29, 2020

@mikee47 Ready?

@mikee47
Copy link
Contributor Author

mikee47 commented Oct 29, 2020

@slaff OK, following further checks against my IFS branch this is working fine now. All done!

@slaff slaff merged commit fa3beb2 into SmingHub:develop Oct 29, 2020
@mikee47 mikee47 deleted the feature/BitSet-upgrade branch October 29, 2020 21:46
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