Skip to content

Commit d652353

Browse files
committed
Move probing logic to control module
1 parent f7aa64a commit d652353

File tree

9 files changed

+538
-503
lines changed

9 files changed

+538
-503
lines changed

src/control/group/generic.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,23 @@ impl Group {
5050
/// Number of bytes in the group.
5151
pub(crate) const WIDTH: usize = mem::size_of::<Self>();
5252

53+
/// Double the group width; size of [`Group::static_empty`].
54+
pub(crate) const DOUBLE_WIDTH: usize = Group::WIDTH * 2;
55+
5356
/// Returns a full group of empty tags, suitable for use as the initial
5457
/// value for an empty hash table.
5558
///
5659
/// This is guaranteed to be aligned to the group size.
5760
#[inline]
58-
pub(crate) const fn static_empty() -> &'static [Tag; Group::WIDTH] {
61+
pub(crate) const fn static_empty() -> &'static [Tag; Group::DOUBLE_WIDTH] {
5962
#[repr(C)]
6063
struct AlignedTags {
6164
_align: [Group; 0],
62-
tags: [Tag; Group::WIDTH],
65+
tags: [Tag; Group::DOUBLE_WIDTH],
6366
}
6467
const ALIGNED_TAGS: AlignedTags = AlignedTags {
6568
_align: [],
66-
tags: [Tag::EMPTY; Group::WIDTH],
69+
tags: [Tag::EMPTY; Group::DOUBLE_WIDTH],
6770
};
6871
&ALIGNED_TAGS.tags
6972
}

src/control/group/neon.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,23 @@ impl Group {
2121
/// Number of bytes in the group.
2222
pub(crate) const WIDTH: usize = mem::size_of::<Self>();
2323

24+
/// Double the group width; size of [`Group::static_empty`].
25+
pub(crate) const DOUBLE_WIDTH: usize = Group::WIDTH * 2;
26+
2427
/// Returns a full group of empty tags, suitable for use as the initial
2528
/// value for an empty hash table.
2629
///
2730
/// This is guaranteed to be aligned to the group size.
2831
#[inline]
29-
pub(crate) const fn static_empty() -> &'static [Tag; Group::WIDTH] {
32+
pub(crate) const fn static_empty() -> &'static [Tag; Group::DOUBLE_WIDTH] {
3033
#[repr(C)]
3134
struct AlignedTags {
3235
_align: [Group; 0],
33-
tags: [Tag; Group::WIDTH],
36+
tags: [Tag; Group::DOUBLE_WIDTH],
3437
}
3538
const ALIGNED_TAGS: AlignedTags = AlignedTags {
3639
_align: [],
37-
tags: [Tag::EMPTY; Group::WIDTH],
40+
tags: [Tag::EMPTY; Group::DOUBLE_WIDTH],
3841
};
3942
&ALIGNED_TAGS.tags
4043
}

src/control/group/sse2.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,24 @@ impl Group {
2626
/// Number of bytes in the group.
2727
pub(crate) const WIDTH: usize = mem::size_of::<Self>();
2828

29+
/// Double the group width; size of [`Group::static_empty`].
30+
pub(crate) const DOUBLE_WIDTH: usize = Group::WIDTH * 2;
31+
2932
/// Returns a full group of empty tags, suitable for use as the initial
3033
/// value for an empty hash table.
3134
///
3235
/// This is guaranteed to be aligned to the group size.
3336
#[inline]
3437
#[allow(clippy::items_after_statements)]
35-
pub(crate) const fn static_empty() -> &'static [Tag; Group::WIDTH] {
38+
pub(crate) const fn static_empty() -> &'static [Tag; Group::DOUBLE_WIDTH] {
3639
#[repr(C)]
3740
struct AlignedTags {
3841
_align: [Group; 0],
39-
tags: [Tag; Group::WIDTH],
42+
tags: [Tag; Group::DOUBLE_WIDTH],
4043
}
4144
const ALIGNED_TAGS: AlignedTags = AlignedTags {
4245
_align: [],
43-
tags: [Tag::EMPTY; Group::WIDTH],
46+
tags: [Tag::EMPTY; Group::DOUBLE_WIDTH],
4447
};
4548
&ALIGNED_TAGS.tags
4649
}

src/control/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
mod bitmask;
22
mod group;
3+
mod probe;
34
mod tag;
45

56
use self::bitmask::BitMask;
67
pub(crate) use self::{
78
bitmask::BitMaskIter,
89
group::Group,
10+
probe::{Probe, ProbeItems},
911
tag::{Tag, TagSliceExt},
1012
};

0 commit comments

Comments
 (0)