struct Mask<V> {
lo: V,
hi: V,
}
Expand description
A vector generic mask for the low and high nybbles in a set of patterns.
Each 8-bit lane j
in a vector corresponds to a bitset where the i
th bit
is set if and only if the nybble j
is in the bucket i
at a particular
position.
This is slightly tweaked dependending on whether Slim or Fat Teddy is being
used. For Slim Teddy, the bitsets in the lower half are the same as the
bitsets in the higher half, so that we can search V::BYTES
bytes at a
time. (Remember, the nybbles in the haystack are used as indices into these
masks, and 256-bit shuffles only operate on 128-bit lanes.)
For Fat Teddy, the bitsets are not repeated, but instead, the high half
bits correspond to an addition 8 buckets. So that a bitset 00100010
has
buckets 1 and 5 set if it’s in the lower half, but has buckets 9 and 13 set
if it’s in the higher half.
Fields§
§lo: V
§hi: V
Implementations§
source§impl<V: Vector> Mask<V>
impl<V: Vector> Mask<V>
sourceunsafe fn members1(chunk: V, masks: [Mask<V>; 1]) -> V
unsafe fn members1(chunk: V, masks: [Mask<V>; 1]) -> V
Return a candidate for Teddy (fat or slim) that is searching for 1-byte candidates.
If a candidate is returned, it will be a collection of 8-bit bitsets
(one bitset per lane), where the ith bit is set in the jth lane if and
only if the byte occurring at the jth lane in chunk
is in the bucket
i
. If no candidate is found, then the vector returned will have all
lanes set to zero.
chunk
should correspond to a V::BYTES
window of the haystack (where
the least significant byte corresponds to the start of the window). For
fat Teddy, the haystack window length should be V::BYTES / 2
, with
the window repeated in each half of the vector.
mask1
should correspond to a low/high mask for the first byte of all
patterns that are being searched.
sourceunsafe fn members2(chunk: V, masks: [Mask<V>; 2]) -> (V, V)
unsafe fn members2(chunk: V, masks: [Mask<V>; 2]) -> (V, V)
Return a candidate for Teddy (fat or slim) that is searching for 2-byte candidates.
If candidates are returned, each will be a collection of 8-bit bitsets
(one bitset per lane), where the ith bit is set in the jth lane if and
only if the byte occurring at the jth lane in chunk
is in the bucket
i
. Each candidate returned corresponds to the first and second bytes
of the patterns being searched. If no candidate is found, then all of
the lanes will be set to zero in at least one of the vectors returned.
chunk
should correspond to a V::BYTES
window of the haystack (where
the least significant byte corresponds to the start of the window). For
fat Teddy, the haystack window length should be V::BYTES / 2
, with
the window repeated in each half of the vector.
The masks should correspond to the masks computed for the first and second bytes of all patterns that are being searched.
sourceunsafe fn members3(chunk: V, masks: [Mask<V>; 3]) -> (V, V, V)
unsafe fn members3(chunk: V, masks: [Mask<V>; 3]) -> (V, V, V)
Return a candidate for Teddy (fat or slim) that is searching for 3-byte candidates.
If candidates are returned, each will be a collection of 8-bit bitsets
(one bitset per lane), where the ith bit is set in the jth lane if and
only if the byte occurring at the jth lane in chunk
is in the bucket
i
. Each candidate returned corresponds to the first, second and third
bytes of the patterns being searched. If no candidate is found, then
all of the lanes will be set to zero in at least one of the vectors
returned.
chunk
should correspond to a V::BYTES
window of the haystack (where
the least significant byte corresponds to the start of the window). For
fat Teddy, the haystack window length should be V::BYTES / 2
, with
the window repeated in each half of the vector.
The masks should correspond to the masks computed for the first, second and third bytes of all patterns that are being searched.
sourceunsafe fn members4(chunk: V, masks: [Mask<V>; 4]) -> (V, V, V, V)
unsafe fn members4(chunk: V, masks: [Mask<V>; 4]) -> (V, V, V, V)
Return a candidate for Teddy (fat or slim) that is searching for 4-byte candidates.
If candidates are returned, each will be a collection of 8-bit bitsets
(one bitset per lane), where the ith bit is set in the jth lane if and
only if the byte occurring at the jth lane in chunk
is in the bucket
i
. Each candidate returned corresponds to the first, second, third
and fourth bytes of the patterns being searched. If no candidate is
found, then all of the lanes will be set to zero in at least one of the
vectors returned.
chunk
should correspond to a V::BYTES
window of the haystack (where
the least significant byte corresponds to the start of the window). For
fat Teddy, the haystack window length should be V::BYTES / 2
, with
the window repeated in each half of the vector.
The masks should correspond to the masks computed for the first, second, third and fourth bytes of all patterns that are being searched.
Trait Implementations§
impl<V: Copy> Copy for Mask<V>
Auto Trait Implementations§
impl<V> Freeze for Mask<V>where
V: Freeze,
impl<V> RefUnwindSafe for Mask<V>where
V: RefUnwindSafe,
impl<V> Send for Mask<V>where
V: Send,
impl<V> Sync for Mask<V>where
V: Sync,
impl<V> Unpin for Mask<V>where
V: Unpin,
impl<V> UnwindSafe for Mask<V>where
V: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)