pub unsafe fn add_to_heap(&mut self,start: usize, mut end: usize) {
        // avoid unaligned access on some platforms
        start = (start + size_of::<usize>() - 1) & (!size_of::<usize>() + 1);
        end = end & (!size_of::<usize>() + 1);
        assert!(start <= end);

        let mut total = 0;
        let mut current_start = start;

        while current_start + size_of::<usize>() <= end {
            let lowbit = current_start & (!current_start + 1);
            let size = min(lowbit, prev_power_of_two(end - current_start));
            total += size;

            self.free_list[size.trailing_zeros() as usize].push(current_start as *mut usize);
            current_start += size;
        }

        self.total += total;
    }
/// Add a range of memory [start, end) to the heap
Add a range of memory [start, end) to the heap
Add a range of memory [ start end ) to the heap
pub unsafe fn add_to_heap(&mut self,start: usize, mut end: usize) {
        // avoid unaligned access on some platforms
        start = (start + size_of::<usize>() - 1) & (!size_of::<usize>() + 1);
        end = end & (!size_of::<usize>() + 1);
        assert!(start <= end);
        let mut total = 0;
        let mut current_start = start;
        while current_start + size_of::<usize>() <= end {
            let lowbit = current_start & (!current_start + 1);
            let size = min(lowbit, prev_power_of_two(end - current_start));
            total += size;
            self.free_list[size.trailing_zeros() as usize].push(current_start as *mut usize);
            current_start += size;
        }
        self.total += total;
    }
pub unsafe fn add_to_heap ( & mut self , start : usize , mut end : usize ) { // avoid unaligned access on some platforms start = ( start + size_of :: < usize > ( ) - 1 ) & ( ! size_of :: < usize > ( ) + 1 ) ; end = end & ( ! size_of :: < usize > ( ) + 1 ) ; assert ! ( start end ) ; let mut total = 0 ; let mut current_start = start ; while current_start + size_of :: < usize > ( ) <= end { let lowbit = current_start & ( ! current_start + 1 ) ; let size = min ( lowbit , prev_power_of_two ( end - current_start ) ) ; total += size ; self . free_list [ size . trailing_zeros ( ) as usize ] . push ( current_start as * mut usize ) ; current_start += size ; } self . total += total ; }
Add a range of memory [start, end) to the heap
Add a range of memory [ start end ) to the heap
&mut self
start
usize
end
usize
&mut self
start
usize
end
usize