Closed
Description
Add bitwise shift (<<
and >>
) operations to BitSet
collection.
Motivation:
- completeness of bitwise operation support
- applicable in Dynamic Programming solutions to the Subset Sum / Knapsack types of problems
- feature parity with C++
std::bitset
: https://en.cppreference.com/w/cpp/utility/bitset/operator_ltltgtgt
Note: <<
can be emulated with .map(_ + shiftBy)
and >>
with .collect { case b if b >= shiftBy => b - shiftBy }
, but performance difference is two orders of magnitude.
I have some existing code for it, will be able to submit a PR soon.
Metadata
Metadata
Assignees
Labels
No labels