|
| 1 | +/** |
| 2 | + * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) |
| 3 | + * |
| 4 | + * This file is part of libbitcoin. |
| 5 | + * |
| 6 | + * This program is free software: you can redistribute it and/or modify |
| 7 | + * it under the terms of the GNU Affero General Public License as published by |
| 8 | + * the Free Software Foundation, either version 3 of the License, or |
| 9 | + * (at your option) any later version. |
| 10 | + * |
| 11 | + * This program is distributed in the hope that it will be useful, |
| 12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | + * GNU Affero General Public License for more details. |
| 15 | + * |
| 16 | + * You should have received a copy of the GNU Affero General Public License |
| 17 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | + */ |
| 19 | +#ifndef LIBBITCOIN_DATABASE_PRIMITIVES_SIEVE_IPP |
| 20 | +#define LIBBITCOIN_DATABASE_PRIMITIVES_SIEVE_IPP |
| 21 | + |
| 22 | +#include <bitcoin/system.hpp> |
| 23 | +#include <bitcoin/database/define.hpp> |
| 24 | + |
| 25 | +// [-------------------screen----------][--------------link--------------] |
| 26 | +// [[selector][--------masks----------]][--------------link--------------] |
| 27 | + |
| 28 | +// [[111][1111111111111111111111111111]] terminal sentinal (empty/default) |
| 29 | +// [[000][1111111111111111111111111111]] 1 screen |
| 30 | +// [[001][2222222222222211111111111111]] 2 screens |
| 31 | +// [[010][3333333333222222222111111111]] 3 screens |
| 32 | +// [[011][4444444333333322222221111111]] 4 screens |
| 33 | +// [[100][5555554444443333332222211111]] 5 screens |
| 34 | +// [[101][6666655555444443333322221111]] 6 screens |
| 35 | +// [[110][7777666655554444333322221111]] 7 screens |
| 36 | +// [[111][-777766665555444433332222111]] 8 screens (partial) |
| 37 | +// [[111][1000000000000000000000000000]] overflow sentinal |
| 38 | + |
| 39 | +// To minimize masking and shifting in alignment, the sieve is defined as a two |
| 40 | +// dimensional matrix of precomputed. One dimension is determined by the |
| 41 | +// screen selector the other is used to iterate through maskes for that screen. |
| 42 | +// A single screen requires one mask, a double two, and so on. The max selector |
| 43 | +// value indicates that the first bit of the screen is a sentinel. This is set |
| 44 | +// for either terminal (all other bits set) or overflow (no other bits set). |
| 45 | +// If the sentinel is unset then the max screen is in used on remaining bits. |
| 46 | +// The seive should be terminal if and only if the link is terminal, and when |
| 47 | +// overflowed implies that the bucket is saturated, rendering it unscreened. |
| 48 | + |
| 49 | +// A 28 bit sieve requires 28 bits from each hashmap key, independent of both |
| 50 | +// the hashmap hash function and each other. The mask is |
| 51 | + |
| 52 | +namespace libbitcoin { |
| 53 | +namespace database { |
| 54 | + |
| 55 | +TEMPLATE |
| 56 | +constexpr CLASS::sieve() NOEXCEPT |
| 57 | +{ |
| 58 | +} |
| 59 | + |
| 60 | +} // namespace database |
| 61 | +} // namespace libbitcoin |
| 62 | + |
| 63 | +#endif |
0 commit comments