Cuts a bit sequence from a number.
More...
#include <cds/algo/split_bitstring.h>
|
|
| number_splitter (int_type n) |
| | Initalizes the splitter with nymber n and initial bit offset 0.
|
| |
|
| number_splitter (int_type n, size_t initial_offset) |
| | Initalizes the splitter with nymber n and initial bit offset initial_offset.
|
| |
|
| operator bool () const |
| | Returns true if end-of-string is not reached yet.
|
| |
|
bool | eos () const |
| | Returns true if end-of-stream encountered.
|
| |
| int_type | cut (unsigned count) |
| | Cuts next count bits (must be multiplier of 8) from the number. More...
|
| |
| int_type | safe_cut (unsigned count) |
| | Cuts up to count from the bit-string. More...
|
| |
|
void | reset () noexcept |
| | Resets the splitter.
|
| |
|
int_type | source () const |
| | Returns initial number.
|
| |
|
size_t | bit_offset () const |
| | Returns current bit offset from beginning of the number.
|
| |
|
size_t | rest_count () const |
| | Returns how many bits remain.
|
| |
|
|
static constexpr bool | is_correct (unsigned count) |
| | Checks if count is multiple of 8.
|
| |
template<typename Int>
class cds::algo::number_splitter< Int >
Cuts a bit sequence from a number.
The splitter can be used as an iterator over bit representation of the number of type Int. Each call of cut() or safe_cut() cuts the bit count specified and keeps the position inside the number for the next call.
Cuts next count bits (must be multiplier of 8) from the number.
For performance reason, the function does not manage out-of-bound condition. To control that use safe_cut().
Cuts up to count from the bit-string.
Safe analog of cut(): if count is more than the rest of int_type, only the rest is returned. When eos() condition is met the function returns 0.
The documentation for this class was generated from the following file:
- cds/algo/split_bitstring.h