Skip to content

Commit

Permalink
use address_to_page_offset more
Browse files Browse the repository at this point in the history
  • Loading branch information
joonazan committed Aug 23, 2024
1 parent 7bc6edb commit a517674
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,9 @@ impl HeapInterface for Heap {
}

fn read_range_big_endian(&self, range: Range<u32>) -> Vec<u8> {
let offset = range.start as usize;
let length = (range.end - range.start) as usize;
let length = range.len() as usize;

let (mut page_idx, mut offset_in_page) = (offset >> 12, offset & (HEAP_PAGE_SIZE - 1));
let (mut page_idx, mut offset_in_page) = address_to_page_offset(range.start);
let mut result = Vec::with_capacity(length);
while result.len() < length {
let len_in_page = (length - result.len()).min(HEAP_PAGE_SIZE - offset_in_page);
Expand Down

0 comments on commit a517674

Please sign in to comment.