pub fn is_allocated(&mut self, off: u64, _len: usize) -> bool {
        self.lock();

        if !self.aux.is_empty() {
            // self.discard();
            return true;
        }

        let end = off + _len as u64 - 1;
        let idx = get_idx(_len);
        for idx in idx..self.last_idx + 1 {
            let len = 1 << idx;
            let mut curr = self.buddies[idx];

            #[cfg(feature = "check_allocator_cyclic_links")]
            let mut links = vec![];

            while let Some(b) = off_to_option(curr) {
                #[cfg(feature = "check_allocator_cyclic_links")]
                {
                    if links.contains(&b) {
                        self.discard();
                        panic!("A cyclic link detected in list {}", idx);
                    } else {
                        links.push(b);
                    }
                }

                let r = b + len;
                if (off >= b && off < r) || (end >= b && end < r) || (off <= b && end >= r) {
                    self.discard();
                    return false;
                }
                if b > off {
                    break;
                }
                curr = Self::buddy(b).next;
                debug_assert_ne!(curr, b, "Cyclic link in is_allocated");
            }
        }
        self.discard();
        true
    }
/// Determines if the given address range is allocated
Determines if the given address range is allocated
Determines if the given address range is allocated
pub fn is_allocated(&mut self, off: u64, _len: usize) -> bool {
        self.lock();
        if !self.aux.is_empty() {
            // self.discard();
            return true;
        }
        let end = off + _len as u64 - 1;
        let idx = get_idx(_len);
        for idx in idx..self.last_idx + 1 {
            let len = 1 << idx;
            let mut curr = self.buddies[idx];
            #[cfg(feature = "check_allocator_cyclic_links")]
            let mut links = vec![];
            while let Some(b) = off_to_option(curr) {
                #[cfg(feature = "check_allocator_cyclic_links")]
                {
                    if links.contains(&b) {
                        self.discard();
                        panic!("A cyclic link detected in list {}", idx);
                    } else {
                        links.push(b);
                    }
                }
                let r = b + len;
                if (off >= b && off < r) || (end >= b && end < r) || (off <= b && end >= r) {
                    self.discard();
                    return false;
                }
                if b > off {
                    break;
                }
                curr = Self::buddy(b).next;
                debug_assert_ne!(curr, b, "Cyclic link in is_allocated");
            }
        }
        self.discard();
        true
    }
pub fn is_allocated ( & mut self , off : u64 , _len : usize ) -> bool { self . lock ( ) ; if ! self . aux . is_empty ( ) { // self.discard(); return true ; } let end = off + _len as u64 - 1 ; let idx = get_idx ( _len ) ; for idx in idx .. self . last_idx + 1 { let len = 1 << idx ; let mut curr = self . buddies [ idx ] ; # [ cfg ( feature " " ) ] let mut links = vec ! [ ] ; while let Some ( b ) = off_to_option ( curr ) { # [ cfg ( feature " " ) ] { if links . contains ( & b ) { self . discard ( ) ; panic ! ( " " idx ) ; } else { links . push ( b ) ; } } let r = b + len ; if ( off >= b && off < r ) || ( end >= b && end < r ) || ( off <= b && end >= r ) { self . discard ( ) ; return false ; } if b > off { break ; } curr = Self :: buddy ( b ) . next ; debug_assert_ne ! ( curr b " " ) ; } } self . discard ( ) ; true }
Determines if the given address range is allocated
Determines if the given address range is allocated
&mut self
off
u64
_len
usize