Skip to content

Commit

Permalink
fix(kernel): just use core's checked_ilog (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed Nov 16, 2022
1 parent cc20a8b commit bc64063
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/arch/x86_64/oops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ pub fn oops(oops: Oops<'_>) -> ! {

// we were in the allocator, so dump the allocator's free list
if oops.involves_allocator() {
use mycelium_util::math::Logarithm;
let crate::allocator::State {
allocating,
deallocating,
Expand All @@ -189,7 +188,10 @@ pub fn oops(oops: Oops<'_>) -> ! {
}

writer.write_char('\n').unwrap();
let digits = (heap_size).checked_ilog(10).unwrap_or(0) + 1;
let digits = {
let digits = (heap_size).checked_ilog(10).unwrap_or(0) + 1;
digits as usize
};
writeln!(&mut writer, "heap stats:").unwrap();
writeln!(
&mut writer,
Expand Down

0 comments on commit bc64063

Please sign in to comment.