Skip to content

Commit 149f9d4

Browse files
committed
Rename sieve type.
1 parent 4774c5c commit 149f9d4

2 files changed

Lines changed: 22 additions & 22 deletions

File tree

include/bitcoin/database/impl/primitives/sieve.ipp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,26 +56,26 @@ constexpr CLASS::sieve() NOEXCEPT
5656
}
5757

5858
TEMPLATE
59-
constexpr CLASS::sieve(sieve_t value) NOEXCEPT
59+
constexpr CLASS::sieve(type value) NOEXCEPT
6060
: sieve_{ value }
6161
{
6262
}
6363

6464
TEMPLATE
65-
constexpr CLASS::sieve_t CLASS::value() const NOEXCEPT
65+
constexpr CLASS::type CLASS::value() const NOEXCEPT
6666
{
6767
return sieve_;
6868
}
6969

7070
TEMPLATE
71-
constexpr CLASS::operator CLASS::sieve_t() const NOEXCEPT
71+
constexpr CLASS::operator CLASS::type() const NOEXCEPT
7272
{
7373
return sieve_;
7474
}
7575

7676
// protected
7777
TEMPLATE
78-
constexpr CLASS::sieve_t CLASS::masks(size_t row, size_t column) const NOEXCEPT
78+
constexpr CLASS::type CLASS::masks(size_t row, size_t column) const NOEXCEPT
7979
{
8080
BC_ASSERT(column <= row);
8181

@@ -85,7 +85,7 @@ constexpr CLASS::sieve_t CLASS::masks(size_t row, size_t column) const NOEXCEPT
8585
}
8686

8787
TEMPLATE
88-
constexpr bool CLASS::screened(sieve_t fingerprint) const NOEXCEPT
88+
constexpr bool CLASS::screened(type fingerprint) const NOEXCEPT
8989
{
9090
using namespace system;
9191
if constexpr (is_zero(limit))
@@ -102,7 +102,7 @@ constexpr bool CLASS::screened(sieve_t fingerprint) const NOEXCEPT
102102
}
103103

104104
// Compare masked fingerprint to masked sieve, for all masks of the screen.
105-
for (sieve_t segment{}; segment <= row; ++segment)
105+
for (type segment{}; segment <= row; ++segment)
106106
{
107107
const auto mask = masks(row, segment);
108108
if (bit_and(fingerprint, mask) == bit_and(sieve_, mask))
@@ -114,7 +114,7 @@ constexpr bool CLASS::screened(sieve_t fingerprint) const NOEXCEPT
114114
}
115115

116116
TEMPLATE
117-
constexpr bool CLASS::screen(sieve_t fingerprint) NOEXCEPT
117+
constexpr bool CLASS::screen(type fingerprint) NOEXCEPT
118118
{
119119
using namespace system;
120120
if constexpr (is_zero(limit))
@@ -192,7 +192,7 @@ CONSTEVAL CLASS::masks_t CLASS::generate_masks() NOEXCEPT
192192
masks_t out{};
193193

194194
// Read/write compressed array as if it was a two-dimesional array.
195-
const auto masks = [&out](auto row, auto column) NOEXCEPT -> sieve_t&
195+
const auto masks = [&out](auto row, auto column) NOEXCEPT -> type&
196196
{
197197
BC_ASSERT(column <= row);
198198
constexpr auto get_offset = generate_offsets();
@@ -209,9 +209,9 @@ CONSTEVAL CLASS::masks_t CLASS::generate_masks() NOEXCEPT
209209
};
210210

211211
masks(0, 0) = first_mask;
212-
for (sieve_t row = 1; row < screens; ++row)
212+
for (type row = 1; row < screens; ++row)
213213
{
214-
for (sieve_t col = 0; col < row; ++col)
214+
for (type col = 0; col < row; ++col)
215215
masks(row, col) = masks(sub1(row), col);
216216

217217
for (auto mask = row; !is_zero(mask); --mask)

include/bitcoin/database/primitives/sieve.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,41 +32,41 @@ template <size_t SieveBits, size_t SelectorBits,
3232
class sieve
3333
{
3434
public:
35-
using sieve_t = unsigned_type<system::to_ceilinged_bytes(SieveBits)>;
35+
using type = unsigned_type<system::to_ceilinged_bytes(SieveBits)>;
3636

3737
/// Initialize empty sieve.
3838
constexpr sieve() NOEXCEPT;
3939

4040
/// Initialize existing sieve.
41-
constexpr sieve(sieve_t value) NOEXCEPT;
41+
constexpr sieve(type value) NOEXCEPT;
4242

4343
/// The fingerprint value.
44-
constexpr sieve_t value() const NOEXCEPT;
44+
constexpr type value() const NOEXCEPT;
4545

4646
/// True if fingerprint aligns with sieve screen(s), bucket may contain.
47-
constexpr bool screened(sieve_t fingerprint) const NOEXCEPT;
47+
constexpr bool screened(type fingerprint) const NOEXCEPT;
4848

4949
/// Add fingerprint to sieve, false if already screened.
50-
constexpr bool screen(sieve_t fingerprint) NOEXCEPT;
50+
constexpr bool screen(type fingerprint) NOEXCEPT;
5151

5252
/// The fingerprint value.
53-
constexpr operator sieve_t() const NOEXCEPT;
53+
constexpr operator type() const NOEXCEPT;
5454

5555
protected:
5656
static constexpr auto sieve_bits = SieveBits;
5757
static constexpr auto selector_bits = SelectorBits;
5858
static constexpr auto screen_bits = sieve_bits - selector_bits;
5959

60-
static constexpr auto empty = system::unmask_right<sieve_t>(sieve_bits);
60+
static constexpr auto empty = system::unmask_right<type>(sieve_bits);
6161
static constexpr auto saturated = system::mask_right(empty, sub1(screen_bits));
62-
static constexpr auto first_mask = system::unmask_right<sieve_t>(screen_bits);
62+
static constexpr auto first_mask = system::unmask_right<type>(screen_bits);
6363
static constexpr auto selector_mask = first_mask;
6464

6565
static constexpr auto screens = system::power2(selector_bits);
6666
static constexpr auto mask_count = to_half(screens * add1(screens));
6767
static constexpr auto limit = sub1(screens);
68-
using masks_t = std_array<sieve_t, mask_count>;
69-
using offsets_t = std_array<size_t, screens>;
68+
using masks_t = std_array<type, mask_count>;
69+
using offsets_t = std_array<type, screens>;
7070

7171
/// Generate compression offsets at compile.
7272
static CONSTEVAL offsets_t generate_offsets() NOEXCEPT;
@@ -75,13 +75,13 @@ class sieve
7575
static CONSTEVAL masks_t generate_masks() NOEXCEPT;
7676

7777
/// Read member compressed mask array as if it was a two-dimesional array.
78-
constexpr sieve_t masks(size_t row, size_t column) const NOEXCEPT;
78+
constexpr type masks(size_t row, size_t column) const NOEXCEPT;
7979

8080
private:
8181
// Logically sparse, e.g. 16 x 16 = 256 table of uint32_t (1024 bytes).
8282
// Compressed to one-dimensional 136 element array of uint32_t (544 bytes).
8383
static constexpr masks_t masks_ = generate_masks();
84-
sieve_t sieve_;
84+
type sieve_;
8585
};
8686

8787
} // namespace database

0 commit comments

Comments
 (0)