Skip to content

Commit 492f75a

Browse files
committed
Simplify math to caluclate the page count for the ramdisk
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.
1 parent 6781934 commit 492f75a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

common/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ where
298298
let physical_address = PhysAddr::new(ramdisk_address);
299299
let ramdisk_physical_start_page: PhysFrame<Size4KiB> =
300300
PhysFrame::containing_address(physical_address);
301-
let ramdisk_page_count = ((system_info.ramdisk_len - 1) / Size4KiB::SIZE) + 1;
301+
let ramdisk_page_count = system_info.ramdisk_len / Size4KiB::SIZE;
302302
let ramdisk_physical_end_page = ramdisk_physical_start_page + ramdisk_page_count;
303303
let start_page = Page::from_start_address(ramdisk_address_start)
304304
.expect("the ramdisk start address must be page aligned");

0 commit comments

Comments
 (0)