65template <
size_t SHARDS_COUNT>
88 return Bitset<>((
byte *)
words.data() + shard_bytes * shard_id, shard_bytes);
122 const size_t shard_id = start_pos % SHARDS_COUNT;
124 const size_t found = bs.find_set(start_pos / SHARDS_COUNT);
125 return found == bs.NOT_FOUND ? found : found * SHARDS_COUNT + shard_id;
A simple bitset wrapper class, which lets you access an existing range of bytes (not owned by it!...
Definition: ut0bitset.h:55
void reset() const
Set all bits to false.
Definition: ut0bitset.h:101
void set(size_t pos, bool v=true) const
Set the specified bit to the value 'bit'.
Definition: ut0bitset.h:91
A Sharded_bitset<SHARDS_COUNT>(n) is like a bitset<n> in that it represents a vector of n bits,...
Definition: ut0sharded_bitset.h:66
Sharded_bitset(size_t n, ut::PSI_memory_key_t mem_key)
Initializes a data structure capable of storing n bits.
Definition: ut0sharded_bitset.h:96
size_t find_set_in_this_shard(size_t start_pos)
Finds a smallest position which is set and belongs to the same shard as start_pos,...
Definition: ut0sharded_bitset.h:121
void reset(size_t pos)
Resets pos-th bit.
Definition: ut0sharded_bitset.h:112
typename decltype(words)::allocator_type words_allocator
Definition: ut0sharded_bitset.h:74
ut::vector< uint64_t > words
The bits for each shard are stored separately to avoid data-races, false-sharing, and make linear sca...
Definition: ut0sharded_bitset.h:73
size_t words_per_shard() const
How many words are devoted to each shard in words[].
Definition: ut0sharded_bitset.h:82
void set(size_t pos)
Sets pos-th bit.
Definition: ut0sharded_bitset.h:106
Bitset get_shard(size_t shard_id) const
Definition: ut0sharded_bitset.h:86
This file contains a set of libraries providing overloads for regular dynamic allocation routines whi...
Definition: aligned_alloc.h:48
constexpr T div_ceil(T numerator, T denominator)
Computes the result of division rounded towards positive infinity.
Definition: ut0math.h:49
std::vector< T, ut::allocator< T > > vector
Specialization of vector which uses allocator.
Definition: ut0new.h:2876
Light-weight and type-safe wrapper around the PSI_memory_key that eliminates the possibility of intro...
Definition: ut0new.h:178
Utilities for bitset operations.
Dynamic memory allocation routines and custom allocators specifically crafted to support memory instr...
int n
Definition: xcom_base.cc:509