| 188 | |
| 189 | template <typename T> |
| 190 | void InitDictValues(int num_values, int num_dicts, std::vector<T>& values, |
| 191 | std::vector<uint8_t>& buffer) { |
| 192 | int repeat_factor = num_values / num_dicts; |
| 193 | InitValues<T>(num_dicts, values, buffer); |
| 194 | // add some repeated values |
| 195 | for (int j = 1; j < repeat_factor; ++j) { |
| 196 | for (int i = 0; i < num_dicts; ++i) { |
| 197 | std::memcpy(&values[num_dicts * j + i], &values[i], sizeof(T)); |
| 198 | } |
| 199 | } |
| 200 | // computed only dict_per_page * repeat_factor - 1 values < num_values |
| 201 | // compute remaining |
| 202 | for (int i = num_dicts * repeat_factor; i < num_values; ++i) { |
| 203 | std::memcpy(&values[i], &values[i - num_dicts * repeat_factor], sizeof(T)); |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | template <> |
| 208 | inline void InitDictValues<bool>(int num_values, int num_dicts, std::vector<bool>& values, |
nothing calls this directly
no outgoing calls
no test coverage detected