offset represents an offset range (a start index plus a count of elements) in a single uint64_t. The lower COUNT_BITS bits are used for the count and the remaining bits are used for the start index.
More...
#include <offset.hh>
|
| | offset (uint64_t start, uint32_t count) |
| | Construct a new offset range from a start index and a count. More...
|
| |
| | offset (const offset &prev, uint32_t count) |
| | Construct a new offset range from a previous offset range and a count. The start index of this offset range is the end index of the previous offset. More...
|
| |
| uint64_t | start () const |
| | Get the start index of the offset range. More...
|
| |
| uint32_t | count () const |
| | Get the count (number) of elements represented by this offset range. More...
|
| |
| uint64_t | end () const |
| | Get the index pointing one element past the final element represented by this offset range. More...
|
| |
| void | set_count (uint32_t count) |
| | Set the count of this offset range. More...
|
| |
| void | set_offset (uint64_t start) |
| | Set the start index of this offset range. More...
|
| |
| std::pair< size_t, size_t > | range () const |
| | Get the range (start index to end index, inclusive) represented by this offset range. More...
|
| |
|
| static constexpr uint32_t | count_mask = (1ul << COUNT_BITS) - 1 |
| | Bitmask used to get the count bits, this is also the maximum value for the count value. More...
|
| |
|
static constexpr uint64_t | start_max = (1ul << (64 - COUNT_BITS)) - 1 |
| | The maximum value of the start index value.
|
| |
template<size_t COUNT_BITS>
class flecsi::util::offset< COUNT_BITS >
offset represents an offset range (a start index plus a count of elements) in a single uint64_t. The lower COUNT_BITS bits are used for the count and the remaining bits are used for the start index.
- Template Parameters
-
| COUNT_BITS | Number of bits used for the count |
◆ offset() [1/2]
template<size_t COUNT_BITS>
Construct a new offset range from a start index and a count.
- Parameters
-
| start | Start index of the offset range |
| count | The count (number) of elements |
◆ offset() [2/2]
template<size_t COUNT_BITS>
Construct a new offset range from a previous offset range and a count. The start index of this offset range is the end index of the previous offset.
- Parameters
-
| prev | Previous offset range, this offset starts immediately after the previous offset range. |
| count | The count (number) of elements |
◆ count()
template<size_t COUNT_BITS>
Get the count (number) of elements represented by this offset range.
- Returns
- uint32_t Number of elements
◆ end()
template<size_t COUNT_BITS>
Get the index pointing one element past the final element represented by this offset range.
- Returns
- uint64_t End index pointing to the first element past the last element in this offset range
◆ range()
template<size_t COUNT_BITS>
Get the range (start index to end index, inclusive) represented by this offset range.
- Returns
- std::pair<size_t, size_t> Range of this offset range
◆ set_count()
template<size_t COUNT_BITS>
Set the count of this offset range.
- Parameters
-
◆ set_offset()
template<size_t COUNT_BITS>
Set the start index of this offset range.
- Parameters
-
| start | New start index value |
◆ start()
template<size_t COUNT_BITS>
Get the start index of the offset range.
- Returns
- uint64_t Start index
◆ count_mask
template<size_t COUNT_BITS>
Bitmask used to get the count bits, this is also the maximum value for the count value.
Since we ensure that COUNT_BITS <= 32, this will always fit into a uint32_t.
The documentation for this class was generated from the following file:
- /home/bergen/devel/tuxfan/flecsi/flecsi/util/offset.hh