Skip to content

Commit

Permalink
Simplify math to caluclate the page count for the ramdisk
Browse files Browse the repository at this point in the history
Rather than replace range_inclusive, we can remove the nesting doll math from ramdisk_page_count instead.
IMO this makes the code a bit more readable.
  • Loading branch information
jasoncouture committed Jan 4, 2023
1 parent 465881e commit b86fb0c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ where
let physical_address = PhysAddr::new(ramdisk_address);
let ramdisk_physical_start_page: PhysFrame<Size4KiB> =
PhysFrame::containing_address(physical_address);
let ramdisk_page_count = ((system_info.ramdisk_len - 1) / Size4KiB::SIZE) + 1;
let ramdisk_page_count = system_info.ramdisk_len / Size4KiB::SIZE;
let ramdisk_physical_end_page = ramdisk_physical_start_page + ramdisk_page_count;
let start_page = Page::from_start_address(ramdisk_address_start)
.expect("the ramdisk start address must be page aligned");
Expand Down

0 comments on commit b86fb0c

Please sign in to comment.