16 template <
bool compressed>
21 if (arguments.
parts == 1u)
23 auto index = generator();
24 store_index(arguments.
out_path, index, arguments);
28 std::vector<std::vector<size_t>> association(arguments.
parts);
29 size_t next_power_of_four{4u};
31 if (arguments.
parts == 4u)
33 for (
size_t i : std::views::iota(0u, arguments.
parts))
34 association[i] = std::vector<size_t>{i};
36 else if (arguments.
parts == 2u)
38 association[0] = std::vector<size_t>{0, 1};
39 association[1] = std::vector<size_t>{2, 3};
44 size_t suffix_length{0};
45 for (; 0b100 << (2 * suffix_length) < arguments.
parts; ++suffix_length)
47 next_power_of_four = 0b100 << (2 * suffix_length);
49 size_t const prefixes_per_part = next_power_of_four / arguments.
parts;
51 for (
size_t i : std::views::iota(0u, next_power_of_four))
52 association[i / prefixes_per_part].push_back(i);
55 for (
size_t part : std::views::iota(0u, arguments.
parts))
57 size_t const mask{next_power_of_four - 1};
58 auto filter_view = std::views::filter(
61 return std::ranges::find(association[part], hash & mask) != association[part].end();
64 auto index = generator(std::move(filter_view));
65 std::filesystem::path out_path{arguments.
out_path};
66 out_path +=
"_" + std::to_string(part);
67 store_index(out_path, index, arguments);
Definition: index_factory.hpp:22
Definition: adjust_seed.hpp:13
void build_from_files(build_arguments const &arguments)
Definition: build_from_files.hpp:17
Definition: build_arguments.hpp:21
uint8_t parts
Definition: build_arguments.hpp:37
std::filesystem::path out_path
Definition: build_arguments.hpp:32