Coverage Report

Created: 2024-10-16 07:58

/rust/registry/src/index.crates.io-6f17d22bba15001f/hashbrown-0.12.3/src/raw/bitmask.rs
Line
Count
Source (jump to first uncovered line)
1
use super::imp::{BitMaskWord, BITMASK_MASK, BITMASK_STRIDE};
2
#[cfg(feature = "nightly")]
3
use core::intrinsics;
4
5
/// A bit mask which contains the result of a `Match` operation on a `Group` and
6
/// allows iterating through them.
7
///
8
/// The bit mask is arranged so that low-order bits represent lower memory
9
/// addresses for group match results.
10
///
11
/// For implementation reasons, the bits in the set may be sparsely packed, so
12
/// that there is only one bit-per-byte used (the high bit, 7). If this is the
13
/// case, `BITMASK_STRIDE` will be 8 to indicate a divide-by-8 should be
14
/// performed on counts/indices to normalize this difference. `BITMASK_MASK` is
15
/// similarly a mask of all the actually-used bits.
16
#[derive(Copy, Clone)]
17
pub struct BitMask(pub BitMaskWord);
18
19
#[allow(clippy::use_self)]
20
impl BitMask {
21
    /// Returns a new `BitMask` with all bits inverted.
22
    #[inline]
23
    #[must_use]
24
50.4k
    pub fn invert(self) -> Self {
25
50.4k
        BitMask(self.0 ^ BITMASK_MASK)
26
50.4k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::invert
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::invert
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::invert
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::invert
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::invert
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::invert
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::invert
<hashbrown::raw::inner::bitmask::BitMask>::invert
Line
Count
Source
24
50.4k
    pub fn invert(self) -> Self {
25
50.4k
        BitMask(self.0 ^ BITMASK_MASK)
26
50.4k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::invert
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::invert
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::invert
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::invert
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::invert
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::invert
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::invert
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::invert
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::invert
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::invert
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::invert
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::invert
27
28
    /// Flip the bit in the mask for the entry at the given index.
29
    ///
30
    /// Returns the bit's previous state.
31
    #[inline]
32
    #[allow(clippy::cast_ptr_alignment)]
33
    #[cfg(feature = "raw")]
34
    pub unsafe fn flip(&mut self, index: usize) -> bool {
35
        // NOTE: The + BITMASK_STRIDE - 1 is to set the high bit.
36
        let mask = 1 << (index * BITMASK_STRIDE + BITMASK_STRIDE - 1);
37
        self.0 ^= mask;
38
        // The bit was set if the bit is now 0.
39
        self.0 & mask == 0
40
    }
41
42
    /// Returns a new `BitMask` with the lowest bit removed.
43
    #[inline]
44
    #[must_use]
45
613k
    pub fn remove_lowest_bit(self) -> Self {
46
613k
        BitMask(self.0 & (self.0 - 1))
47
613k
    }
<hashbrown::raw::inner::bitmask::BitMask>::remove_lowest_bit
Line
Count
Source
45
109
    pub fn remove_lowest_bit(self) -> Self {
46
109
        BitMask(self.0 & (self.0 - 1))
47
109
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::remove_lowest_bit
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::remove_lowest_bit
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::remove_lowest_bit
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::remove_lowest_bit
<hashbrown::raw::inner::bitmask::BitMask>::remove_lowest_bit
Line
Count
Source
45
15.9k
    pub fn remove_lowest_bit(self) -> Self {
46
15.9k
        BitMask(self.0 & (self.0 - 1))
47
15.9k
    }
<hashbrown::raw::inner::bitmask::BitMask>::remove_lowest_bit
Line
Count
Source
45
1.50k
    pub fn remove_lowest_bit(self) -> Self {
46
1.50k
        BitMask(self.0 & (self.0 - 1))
47
1.50k
    }
<hashbrown::raw::inner::bitmask::BitMask>::remove_lowest_bit
Line
Count
Source
45
575k
    pub fn remove_lowest_bit(self) -> Self {
46
575k
        BitMask(self.0 & (self.0 - 1))
47
575k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::remove_lowest_bit
<hashbrown::raw::inner::bitmask::BitMask>::remove_lowest_bit
Line
Count
Source
45
1.01k
    pub fn remove_lowest_bit(self) -> Self {
46
1.01k
        BitMask(self.0 & (self.0 - 1))
47
1.01k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::remove_lowest_bit
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::remove_lowest_bit
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::remove_lowest_bit
<hashbrown::raw::inner::bitmask::BitMask>::remove_lowest_bit
Line
Count
Source
45
2.34k
    pub fn remove_lowest_bit(self) -> Self {
46
2.34k
        BitMask(self.0 & (self.0 - 1))
47
2.34k
    }
<hashbrown::raw::inner::bitmask::BitMask>::remove_lowest_bit
Line
Count
Source
45
17.2k
    pub fn remove_lowest_bit(self) -> Self {
46
17.2k
        BitMask(self.0 & (self.0 - 1))
47
17.2k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::remove_lowest_bit
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::remove_lowest_bit
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::remove_lowest_bit
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::remove_lowest_bit
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::remove_lowest_bit
48
    /// Returns whether the `BitMask` has at least one set bit.
49
    #[inline]
50
504k
    pub fn any_bit_set(self) -> bool {
51
504k
        self.0 != 0
52
504k
    }
<hashbrown::raw::inner::bitmask::BitMask>::any_bit_set
Line
Count
Source
50
1.53k
    pub fn any_bit_set(self) -> bool {
51
1.53k
        self.0 != 0
52
1.53k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::any_bit_set
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::any_bit_set
<hashbrown::raw::inner::bitmask::BitMask>::any_bit_set
Line
Count
Source
50
28.4k
    pub fn any_bit_set(self) -> bool {
51
28.4k
        self.0 != 0
52
28.4k
    }
<hashbrown::raw::inner::bitmask::BitMask>::any_bit_set
Line
Count
Source
50
394k
    pub fn any_bit_set(self) -> bool {
51
394k
        self.0 != 0
52
394k
    }
<hashbrown::raw::inner::bitmask::BitMask>::any_bit_set
Line
Count
Source
50
27
    pub fn any_bit_set(self) -> bool {
51
27
        self.0 != 0
52
27
    }
<hashbrown::raw::inner::bitmask::BitMask>::any_bit_set
Line
Count
Source
50
1.74k
    pub fn any_bit_set(self) -> bool {
51
1.74k
        self.0 != 0
52
1.74k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::any_bit_set
<hashbrown::raw::inner::bitmask::BitMask>::any_bit_set
Line
Count
Source
50
17.5k
    pub fn any_bit_set(self) -> bool {
51
17.5k
        self.0 != 0
52
17.5k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::any_bit_set
<hashbrown::raw::inner::bitmask::BitMask>::any_bit_set
Line
Count
Source
50
61.0k
    pub fn any_bit_set(self) -> bool {
51
61.0k
        self.0 != 0
52
61.0k
    }
<hashbrown::raw::inner::bitmask::BitMask>::any_bit_set
Line
Count
Source
50
67
    pub fn any_bit_set(self) -> bool {
51
67
        self.0 != 0
52
67
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::any_bit_set
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::any_bit_set
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::any_bit_set
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::any_bit_set
53
54
    /// Returns the first set bit in the `BitMask`, if there is one.
55
    #[inline]
56
1.69M
    pub fn lowest_set_bit(self) -> Option<usize> {
57
1.69M
        if self.0 == 0 {
58
534k
            None
59
        } else {
60
1.16M
            Some(unsafe { self.lowest_set_bit_nonzero() })
61
        }
62
1.69M
    }
<hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit
Line
Count
Source
56
4.93k
    pub fn lowest_set_bit(self) -> Option<usize> {
57
4.93k
        if self.0 == 0 {
58
1.56k
            None
59
        } else {
60
3.36k
            Some(unsafe { self.lowest_set_bit_nonzero() })
61
        }
62
4.93k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit
<hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit
Line
Count
Source
56
85.2k
    pub fn lowest_set_bit(self) -> Option<usize> {
57
85.2k
        if self.0 == 0 {
58
28.4k
            None
59
        } else {
60
56.8k
            Some(unsafe { self.lowest_set_bit_nonzero() })
61
        }
62
85.2k
    }
<hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit
Line
Count
Source
56
804k
    pub fn lowest_set_bit(self) -> Option<usize> {
57
804k
        if self.0 == 0 {
58
398k
            None
59
        } else {
60
406k
            Some(unsafe { self.lowest_set_bit_nonzero() })
61
        }
62
804k
    }
<hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit
Line
Count
Source
56
1.53k
    pub fn lowest_set_bit(self) -> Option<usize> {
57
1.53k
        if self.0 == 0 {
58
27
            None
59
        } else {
60
1.50k
            Some(unsafe { self.lowest_set_bit_nonzero() })
61
        }
62
1.53k
    }
<hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit
Line
Count
Source
56
602k
    pub fn lowest_set_bit(self) -> Option<usize> {
57
602k
        if self.0 == 0 {
58
27.0k
            None
59
        } else {
60
575k
            Some(unsafe { self.lowest_set_bit_nonzero() })
61
        }
62
602k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit
<hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit
Line
Count
Source
56
58.3k
    pub fn lowest_set_bit(self) -> Option<usize> {
57
58.3k
        if self.0 == 0 {
58
17.9k
            None
59
        } else {
60
40.3k
            Some(unsafe { self.lowest_set_bit_nonzero() })
61
        }
62
58.3k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit
<hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit
Line
Count
Source
56
124k
    pub fn lowest_set_bit(self) -> Option<usize> {
57
124k
        if self.0 == 0 {
58
61.6k
            None
59
        } else {
60
62.8k
            Some(unsafe { self.lowest_set_bit_nonzero() })
61
        }
62
124k
    }
<hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit
Line
Count
Source
56
17.3k
    pub fn lowest_set_bit(self) -> Option<usize> {
57
17.3k
        if self.0 == 0 {
58
67
            None
59
        } else {
60
17.2k
            Some(unsafe { self.lowest_set_bit_nonzero() })
61
        }
62
17.3k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit
63
64
    /// Returns the first set bit in the `BitMask`, if there is one. The
65
    /// bitmask must not be empty.
66
    #[inline]
67
    #[cfg(feature = "nightly")]
68
    pub unsafe fn lowest_set_bit_nonzero(self) -> usize {
69
        intrinsics::cttz_nonzero(self.0) as usize / BITMASK_STRIDE
70
    }
71
    #[inline]
72
    #[cfg(not(feature = "nightly"))]
73
1.16M
    pub unsafe fn lowest_set_bit_nonzero(self) -> usize {
74
1.16M
        self.trailing_zeros()
75
1.16M
    }
<hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit_nonzero
Line
Count
Source
73
3.39k
    pub unsafe fn lowest_set_bit_nonzero(self) -> usize {
74
3.39k
        self.trailing_zeros()
75
3.39k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit_nonzero
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit_nonzero
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit_nonzero
<hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit_nonzero
Line
Count
Source
73
56.8k
    pub unsafe fn lowest_set_bit_nonzero(self) -> usize {
74
56.8k
        self.trailing_zeros()
75
56.8k
    }
<hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit_nonzero
Line
Count
Source
73
407k
    pub unsafe fn lowest_set_bit_nonzero(self) -> usize {
74
407k
        self.trailing_zeros()
75
407k
    }
<hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit_nonzero
Line
Count
Source
73
1.50k
    pub unsafe fn lowest_set_bit_nonzero(self) -> usize {
74
1.50k
        self.trailing_zeros()
75
1.50k
    }
<hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit_nonzero
Line
Count
Source
73
575k
    pub unsafe fn lowest_set_bit_nonzero(self) -> usize {
74
575k
        self.trailing_zeros()
75
575k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit_nonzero
<hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit_nonzero
Line
Count
Source
73
40.8k
    pub unsafe fn lowest_set_bit_nonzero(self) -> usize {
74
40.8k
        self.trailing_zeros()
75
40.8k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit_nonzero
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit_nonzero
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit_nonzero
<hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit_nonzero
Line
Count
Source
73
62.9k
    pub unsafe fn lowest_set_bit_nonzero(self) -> usize {
74
62.9k
        self.trailing_zeros()
75
62.9k
    }
<hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit_nonzero
Line
Count
Source
73
17.2k
    pub unsafe fn lowest_set_bit_nonzero(self) -> usize {
74
17.2k
        self.trailing_zeros()
75
17.2k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit_nonzero
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit_nonzero
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit_nonzero
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit_nonzero
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::lowest_set_bit_nonzero
76
77
    /// Returns the number of trailing zeroes in the `BitMask`.
78
    #[inline]
79
1.16M
    pub fn trailing_zeros(self) -> usize {
80
1.16M
        // ARM doesn't have a trailing_zeroes instruction, and instead uses
81
1.16M
        // reverse_bits (RBIT) + leading_zeroes (CLZ). However older ARM
82
1.16M
        // versions (pre-ARMv7) don't have RBIT and need to emulate it
83
1.16M
        // instead. Since we only have 1 bit set in each byte on ARM, we can
84
1.16M
        // use swap_bytes (REV) + leading_zeroes instead.
85
1.16M
        if cfg!(target_arch = "arm") && BITMASK_STRIDE % 8 == 0 {
86
0
            self.0.swap_bytes().leading_zeros() as usize / BITMASK_STRIDE
87
        } else {
88
1.16M
            self.0.trailing_zeros() as usize / BITMASK_STRIDE
89
        }
90
1.16M
    }
<hashbrown::raw::inner::bitmask::BitMask>::trailing_zeros
Line
Count
Source
79
3.39k
    pub fn trailing_zeros(self) -> usize {
80
3.39k
        // ARM doesn't have a trailing_zeroes instruction, and instead uses
81
3.39k
        // reverse_bits (RBIT) + leading_zeroes (CLZ). However older ARM
82
3.39k
        // versions (pre-ARMv7) don't have RBIT and need to emulate it
83
3.39k
        // instead. Since we only have 1 bit set in each byte on ARM, we can
84
3.39k
        // use swap_bytes (REV) + leading_zeroes instead.
85
3.39k
        if cfg!(target_arch = "arm") && BITMASK_STRIDE % 8 == 0 {
86
0
            self.0.swap_bytes().leading_zeros() as usize / BITMASK_STRIDE
87
        } else {
88
3.39k
            self.0.trailing_zeros() as usize / BITMASK_STRIDE
89
        }
90
3.39k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::trailing_zeros
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::trailing_zeros
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::trailing_zeros
<hashbrown::raw::inner::bitmask::BitMask>::trailing_zeros
Line
Count
Source
79
56.8k
    pub fn trailing_zeros(self) -> usize {
80
56.8k
        // ARM doesn't have a trailing_zeroes instruction, and instead uses
81
56.8k
        // reverse_bits (RBIT) + leading_zeroes (CLZ). However older ARM
82
56.8k
        // versions (pre-ARMv7) don't have RBIT and need to emulate it
83
56.8k
        // instead. Since we only have 1 bit set in each byte on ARM, we can
84
56.8k
        // use swap_bytes (REV) + leading_zeroes instead.
85
56.8k
        if cfg!(target_arch = "arm") && BITMASK_STRIDE % 8 == 0 {
86
0
            self.0.swap_bytes().leading_zeros() as usize / BITMASK_STRIDE
87
        } else {
88
56.8k
            self.0.trailing_zeros() as usize / BITMASK_STRIDE
89
        }
90
56.8k
    }
<hashbrown::raw::inner::bitmask::BitMask>::trailing_zeros
Line
Count
Source
79
407k
    pub fn trailing_zeros(self) -> usize {
80
407k
        // ARM doesn't have a trailing_zeroes instruction, and instead uses
81
407k
        // reverse_bits (RBIT) + leading_zeroes (CLZ). However older ARM
82
407k
        // versions (pre-ARMv7) don't have RBIT and need to emulate it
83
407k
        // instead. Since we only have 1 bit set in each byte on ARM, we can
84
407k
        // use swap_bytes (REV) + leading_zeroes instead.
85
407k
        if cfg!(target_arch = "arm") && BITMASK_STRIDE % 8 == 0 {
86
0
            self.0.swap_bytes().leading_zeros() as usize / BITMASK_STRIDE
87
        } else {
88
407k
            self.0.trailing_zeros() as usize / BITMASK_STRIDE
89
        }
90
407k
    }
<hashbrown::raw::inner::bitmask::BitMask>::trailing_zeros
Line
Count
Source
79
1.50k
    pub fn trailing_zeros(self) -> usize {
80
1.50k
        // ARM doesn't have a trailing_zeroes instruction, and instead uses
81
1.50k
        // reverse_bits (RBIT) + leading_zeroes (CLZ). However older ARM
82
1.50k
        // versions (pre-ARMv7) don't have RBIT and need to emulate it
83
1.50k
        // instead. Since we only have 1 bit set in each byte on ARM, we can
84
1.50k
        // use swap_bytes (REV) + leading_zeroes instead.
85
1.50k
        if cfg!(target_arch = "arm") && BITMASK_STRIDE % 8 == 0 {
86
0
            self.0.swap_bytes().leading_zeros() as usize / BITMASK_STRIDE
87
        } else {
88
1.50k
            self.0.trailing_zeros() as usize / BITMASK_STRIDE
89
        }
90
1.50k
    }
<hashbrown::raw::inner::bitmask::BitMask>::trailing_zeros
Line
Count
Source
79
575k
    pub fn trailing_zeros(self) -> usize {
80
575k
        // ARM doesn't have a trailing_zeroes instruction, and instead uses
81
575k
        // reverse_bits (RBIT) + leading_zeroes (CLZ). However older ARM
82
575k
        // versions (pre-ARMv7) don't have RBIT and need to emulate it
83
575k
        // instead. Since we only have 1 bit set in each byte on ARM, we can
84
575k
        // use swap_bytes (REV) + leading_zeroes instead.
85
575k
        if cfg!(target_arch = "arm") && BITMASK_STRIDE % 8 == 0 {
86
0
            self.0.swap_bytes().leading_zeros() as usize / BITMASK_STRIDE
87
        } else {
88
575k
            self.0.trailing_zeros() as usize / BITMASK_STRIDE
89
        }
90
575k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::trailing_zeros
<hashbrown::raw::inner::bitmask::BitMask>::trailing_zeros
Line
Count
Source
79
40.8k
    pub fn trailing_zeros(self) -> usize {
80
40.8k
        // ARM doesn't have a trailing_zeroes instruction, and instead uses
81
40.8k
        // reverse_bits (RBIT) + leading_zeroes (CLZ). However older ARM
82
40.8k
        // versions (pre-ARMv7) don't have RBIT and need to emulate it
83
40.8k
        // instead. Since we only have 1 bit set in each byte on ARM, we can
84
40.8k
        // use swap_bytes (REV) + leading_zeroes instead.
85
40.8k
        if cfg!(target_arch = "arm") && BITMASK_STRIDE % 8 == 0 {
86
0
            self.0.swap_bytes().leading_zeros() as usize / BITMASK_STRIDE
87
        } else {
88
40.8k
            self.0.trailing_zeros() as usize / BITMASK_STRIDE
89
        }
90
40.8k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::trailing_zeros
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::trailing_zeros
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::trailing_zeros
<hashbrown::raw::inner::bitmask::BitMask>::trailing_zeros
Line
Count
Source
79
62.9k
    pub fn trailing_zeros(self) -> usize {
80
62.9k
        // ARM doesn't have a trailing_zeroes instruction, and instead uses
81
62.9k
        // reverse_bits (RBIT) + leading_zeroes (CLZ). However older ARM
82
62.9k
        // versions (pre-ARMv7) don't have RBIT and need to emulate it
83
62.9k
        // instead. Since we only have 1 bit set in each byte on ARM, we can
84
62.9k
        // use swap_bytes (REV) + leading_zeroes instead.
85
62.9k
        if cfg!(target_arch = "arm") && BITMASK_STRIDE % 8 == 0 {
86
0
            self.0.swap_bytes().leading_zeros() as usize / BITMASK_STRIDE
87
        } else {
88
62.9k
            self.0.trailing_zeros() as usize / BITMASK_STRIDE
89
        }
90
62.9k
    }
<hashbrown::raw::inner::bitmask::BitMask>::trailing_zeros
Line
Count
Source
79
17.2k
    pub fn trailing_zeros(self) -> usize {
80
17.2k
        // ARM doesn't have a trailing_zeroes instruction, and instead uses
81
17.2k
        // reverse_bits (RBIT) + leading_zeroes (CLZ). However older ARM
82
17.2k
        // versions (pre-ARMv7) don't have RBIT and need to emulate it
83
17.2k
        // instead. Since we only have 1 bit set in each byte on ARM, we can
84
17.2k
        // use swap_bytes (REV) + leading_zeroes instead.
85
17.2k
        if cfg!(target_arch = "arm") && BITMASK_STRIDE % 8 == 0 {
86
0
            self.0.swap_bytes().leading_zeros() as usize / BITMASK_STRIDE
87
        } else {
88
17.2k
            self.0.trailing_zeros() as usize / BITMASK_STRIDE
89
        }
90
17.2k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::trailing_zeros
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::trailing_zeros
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::trailing_zeros
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::trailing_zeros
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask>::trailing_zeros
91
92
    /// Returns the number of leading zeroes in the `BitMask`.
93
    #[inline]
94
    pub fn leading_zeros(self) -> usize {
95
        self.0.leading_zeros() as usize / BITMASK_STRIDE
96
    }
97
}
98
99
impl IntoIterator for BitMask {
100
    type Item = usize;
101
    type IntoIter = BitMaskIter;
102
103
    #[inline]
104
714k
    fn into_iter(self) -> BitMaskIter {
105
714k
        BitMaskIter(self)
106
714k
    }
<hashbrown::raw::inner::bitmask::BitMask as core::iter::traits::collect::IntoIterator>::into_iter
Line
Count
Source
104
1.53k
    fn into_iter(self) -> BitMaskIter {
105
1.53k
        BitMaskIter(self)
106
1.53k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask as core::iter::traits::collect::IntoIterator>::into_iter
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask as core::iter::traits::collect::IntoIterator>::into_iter
<hashbrown::raw::inner::bitmask::BitMask as core::iter::traits::collect::IntoIterator>::into_iter
Line
Count
Source
104
28.4k
    fn into_iter(self) -> BitMaskIter {
105
28.4k
        BitMaskIter(self)
106
28.4k
    }
<hashbrown::raw::inner::bitmask::BitMask as core::iter::traits::collect::IntoIterator>::into_iter
Line
Count
Source
104
394k
    fn into_iter(self) -> BitMaskIter {
105
394k
        BitMaskIter(self)
106
394k
    }
<hashbrown::raw::inner::bitmask::BitMask as core::iter::traits::collect::IntoIterator>::into_iter
Line
Count
Source
104
1.52k
    fn into_iter(self) -> BitMaskIter {
105
1.52k
        BitMaskIter(self)
106
1.52k
    }
<hashbrown::raw::inner::bitmask::BitMask as core::iter::traits::collect::IntoIterator>::into_iter
Line
Count
Source
104
192k
    fn into_iter(self) -> BitMaskIter {
105
192k
        BitMaskIter(self)
106
192k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask as core::iter::traits::collect::IntoIterator>::into_iter
<hashbrown::raw::inner::bitmask::BitMask as core::iter::traits::collect::IntoIterator>::into_iter
Line
Count
Source
104
17.5k
    fn into_iter(self) -> BitMaskIter {
105
17.5k
        BitMaskIter(self)
106
17.5k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask as core::iter::traits::collect::IntoIterator>::into_iter
<hashbrown::raw::inner::bitmask::BitMask as core::iter::traits::collect::IntoIterator>::into_iter
Line
Count
Source
104
61.0k
    fn into_iter(self) -> BitMaskIter {
105
61.0k
        BitMaskIter(self)
106
61.0k
    }
<hashbrown::raw::inner::bitmask::BitMask as core::iter::traits::collect::IntoIterator>::into_iter
Line
Count
Source
104
17.2k
    fn into_iter(self) -> BitMaskIter {
105
17.2k
        BitMaskIter(self)
106
17.2k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask as core::iter::traits::collect::IntoIterator>::into_iter
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask as core::iter::traits::collect::IntoIterator>::into_iter
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask as core::iter::traits::collect::IntoIterator>::into_iter
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMask as core::iter::traits::collect::IntoIterator>::into_iter
107
}
108
109
/// Iterator over the contents of a `BitMask`, returning the indices of set
110
/// bits.
111
pub struct BitMaskIter(BitMask);
112
113
impl Iterator for BitMaskIter {
114
    type Item = usize;
115
116
    #[inline]
117
735k
    fn next(&mut self) -> Option<usize> {
118
735k
        let bit = self.0.lowest_set_bit()?;
119
230k
        self.0 = self.0.remove_lowest_bit();
120
230k
        Some(bit)
121
735k
    }
<hashbrown::raw::inner::bitmask::BitMaskIter as core::iter::traits::iterator::Iterator>::next
Line
Count
Source
117
1.64k
    fn next(&mut self) -> Option<usize> {
118
1.64k
        let bit = self.0.lowest_set_bit()?;
119
109
        self.0 = self.0.remove_lowest_bit();
120
109
        Some(bit)
121
1.64k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMaskIter as core::iter::traits::iterator::Iterator>::next
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMaskIter as core::iter::traits::iterator::Iterator>::next
<hashbrown::raw::inner::bitmask::BitMaskIter as core::iter::traits::iterator::Iterator>::next
Line
Count
Source
117
28.4k
    fn next(&mut self) -> Option<usize> {
118
28.4k
        let bit = self.0.lowest_set_bit()?;
119
0
        self.0 = self.0.remove_lowest_bit();
120
0
        Some(bit)
121
28.4k
    }
<hashbrown::raw::inner::bitmask::BitMaskIter as core::iter::traits::iterator::Iterator>::next
Line
Count
Source
117
410k
    fn next(&mut self) -> Option<usize> {
118
410k
        let bit = self.0.lowest_set_bit()?;
119
15.9k
        self.0 = self.0.remove_lowest_bit();
120
15.9k
        Some(bit)
121
410k
    }
<hashbrown::raw::inner::bitmask::BitMaskIter as core::iter::traits::iterator::Iterator>::next
Line
Count
Source
117
1.53k
    fn next(&mut self) -> Option<usize> {
118
1.53k
        let bit = self.0.lowest_set_bit()?;
119
1.50k
        self.0 = self.0.remove_lowest_bit();
120
1.50k
        Some(bit)
121
1.53k
    }
<hashbrown::raw::inner::bitmask::BitMaskIter as core::iter::traits::iterator::Iterator>::next
Line
Count
Source
117
194k
    fn next(&mut self) -> Option<usize> {
118
194k
        let bit = self.0.lowest_set_bit()?;
119
192k
        self.0 = self.0.remove_lowest_bit();
120
192k
        Some(bit)
121
194k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMaskIter as core::iter::traits::iterator::Iterator>::next
<hashbrown::raw::inner::bitmask::BitMaskIter as core::iter::traits::iterator::Iterator>::next
Line
Count
Source
117
18.5k
    fn next(&mut self) -> Option<usize> {
118
18.5k
        let bit = self.0.lowest_set_bit()?;
119
1.01k
        self.0 = self.0.remove_lowest_bit();
120
1.01k
        Some(bit)
121
18.5k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMaskIter as core::iter::traits::iterator::Iterator>::next
<hashbrown::raw::inner::bitmask::BitMaskIter as core::iter::traits::iterator::Iterator>::next
Line
Count
Source
117
63.4k
    fn next(&mut self) -> Option<usize> {
118
63.4k
        let bit = self.0.lowest_set_bit()?;
119
2.34k
        self.0 = self.0.remove_lowest_bit();
120
2.34k
        Some(bit)
121
63.4k
    }
<hashbrown::raw::inner::bitmask::BitMaskIter as core::iter::traits::iterator::Iterator>::next
Line
Count
Source
117
17.3k
    fn next(&mut self) -> Option<usize> {
118
17.3k
        let bit = self.0.lowest_set_bit()?;
119
17.2k
        self.0 = self.0.remove_lowest_bit();
120
17.2k
        Some(bit)
121
17.3k
    }
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMaskIter as core::iter::traits::iterator::Iterator>::next
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMaskIter as core::iter::traits::iterator::Iterator>::next
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMaskIter as core::iter::traits::iterator::Iterator>::next
Unexecuted instantiation: <hashbrown::raw::inner::bitmask::BitMaskIter as core::iter::traits::iterator::Iterator>::next
122
}