Skip to content

Commit b86fb0c

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 465881e commit b86fb0c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

common/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ where
281281
let physical_address = PhysAddr::new(ramdisk_address);
282282
let ramdisk_physical_start_page: PhysFrame<Size4KiB> =
283283
PhysFrame::containing_address(physical_address);
284-
let ramdisk_page_count = ((system_info.ramdisk_len - 1) / Size4KiB::SIZE) + 1;
284+
let ramdisk_page_count = system_info.ramdisk_len / Size4KiB::SIZE;
285285
let ramdisk_physical_end_page = ramdisk_physical_start_page + ramdisk_page_count;
286286
let start_page = Page::from_start_address(ramdisk_address_start)
287287
.expect("the ramdisk start address must be page aligned");

0 commit comments

Comments
 (0)