25 #ifndef __TERVEL_CONTAINERS_WF_VECTOR_VECTOR_ARRAY_ARRAY_H
26 #define __TERVEL_CONTAINERS_WF_VECTOR_VECTOR_ARRAY_ARRAY_H
33 namespace containers {
79 if (cur_seg ==
nullptr) {
101 ArrayElement *
get_spot(
const size_t raw_pos,
const bool no_add =
false) {
104 return &(seg[raw_pos]);
106 static const int nobits = (
sizeof(
unsigned int) << 3) - 1;
107 size_t pos = raw_pos +
offset_;
108 size_t num = nobits - __builtin_clz(pos);
110 size_t elem_pos = pos ^ (1 << num);
114 if (seg ==
nullptr && !no_add) {
119 if (seg !=
nullptr) {
120 return &(seg[elem_pos]);
128 ArrayElement * temp =
new ArrayElement[
capacity];
129 for (uint64_t i = 0; i <
capacity; i++) {
153 #endif // __TERVEL_CONTAINERS_WF_VECTOR_VECTOR_
std::atomic< ArraySegment > array_of_arrays[k_max_array_segments_]
Definition: array_array.h:143
std::atomic< T > ArrayElement
Definition: array_array.h:39
ArrayArray(size_t capacity, T default_value=nullptr)
This class contains code related to managing elements stored in the vector It stores elements on a se...
Definition: array_array.h:52
~ArrayArray()
Definition: array_array.h:64
const T default_value_
Definition: array_array.h:140
TODO(steven):
Definition: mcas.h:36
ArrayElement * ArraySegment
Definition: array_array.h:40
size_t offset_pow_
Definition: array_array.h:144
std::atomic< size_t > current_capacity_
Definition: array_array.h:146
int round_to_next_power_of_two(uint64_t value)
Returns the next power of two.
Definition: wf_hash_map_no_delete.h:44
size_t capacity()
Definition: array_array.h:135
Definition: vector_array.h:38
ArrayElement * allocate_array_segment(const size_t capacity)
Definition: array_array.h:127
Definition: array_array.h:38
size_t offset_
Definition: array_array.h:144
ArrayElement * get_spot(const size_t raw_pos, const bool no_add=false)
This function returns the address of the specified position.
Definition: array_array.h:101
ArraySegment add_segment(const size_t pos)
This function adds an array segment to the arrays used to hold additional elements.
Definition: array_array.h:76
static const size_t k_max_array_segments_
Definition: array_array.h:141