Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Overflow & Displacement tracking. #517

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,38 @@ default = ["ahash", "inline-more", "allocator-api2"]
nightly = ["allocator-api2?/nightly", "bumpalo/allocator_api"]

rustc-internal-api = []

rustc-dep-of-std = [
"nightly",
"core",
"compiler_builtins",
"alloc",
"rustc-internal-api",
]

raw = []

# Enables usage of `#[inline]` on far more functions than by default in this
# crate. This may lead to a performance increase but often comes at a compile
# time cost.
inline-more = []

# If no overflow-tracker is selected, then the default is none.
#
# A single tracker can be selected at any time, selecting two or more is an error.

# Bloom filter overflow-tracker, ala boost::unordered_flat_map.
overflow-tracker-bloom-1-u8 = []

# Bloom filter overflow-tracker, with more accuracy.
overflow-tracker-bloom-1-u16 = []

# Counter overflow-tracker, ala F14.
overflow-tracker-counter-u8 = []

# Hybrid overflow-tracker, mixing a counter and a bloom filter.
overflow-tracker-hybrid = []

[package.metadata.docs.rs]
features = ["nightly", "rayon", "serde", "raw"]
rustdoc-args = ["--generate-link-to-definition"]
21 changes: 0 additions & 21 deletions src/raw/bitmask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,6 @@ impl BitMask {
}
}

/// Returns the number of trailing zeroes in the `BitMask`.
#[inline]
pub(crate) fn trailing_zeros(self) -> usize {
// ARM doesn't have a trailing_zeroes instruction, and instead uses
// reverse_bits (RBIT) + leading_zeroes (CLZ). However older ARM
// versions (pre-ARMv7) don't have RBIT and need to emulate it
// instead. Since we only have 1 bit set in each byte on ARM, we can
// use swap_bytes (REV) + leading_zeroes instead.
if cfg!(target_arch = "arm") && BITMASK_STRIDE % 8 == 0 {
self.0.swap_bytes().leading_zeros() as usize / BITMASK_STRIDE
} else {
self.0.trailing_zeros() as usize / BITMASK_STRIDE
}
}

/// Same as above but takes a `NonZeroBitMaskWord`.
#[inline]
fn nonzero_trailing_zeros(nonzero: NonZeroBitMaskWord) -> usize {
Expand All @@ -80,12 +65,6 @@ impl BitMask {
nonzero.trailing_zeros() as usize / BITMASK_STRIDE
}
}

/// Returns the number of leading zeroes in the `BitMask`.
#[inline]
pub(crate) fn leading_zeros(self) -> usize {
self.0.leading_zeros() as usize / BITMASK_STRIDE
}
}

impl IntoIterator for BitMask {
Expand Down
7 changes: 0 additions & 7 deletions src/raw/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,6 @@ impl Group {
&ALIGNED_BYTES.bytes
}

/// Loads a group of bytes starting at the given address.
#[inline]
#[allow(clippy::cast_ptr_alignment)] // unaligned load
pub(crate) unsafe fn load(ptr: *const u8) -> Self {
Group(ptr::read_unaligned(ptr.cast()))
}

/// Loads a group of bytes starting at the given address, which must be
/// aligned to `mem::align_of::<Group>()`.
#[inline]
Expand Down
Loading
Loading