Skip to content

Commit

Permalink
Merge pull request #34 from Dr-TSNG/master
Browse files Browse the repository at this point in the history
Make FrameAllocator::new const
  • Loading branch information
jiegec authored Jul 26, 2024
2 parents 52eac27 + eea4d1c commit 95e5d6c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/frame.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use super::prev_power_of_two;
use alloc::collections::BTreeSet;
use core::alloc::Layout;
use core::array;
use core::cmp::{max, min};
use core::ops::Range;

Expand Down Expand Up @@ -41,9 +40,9 @@ pub struct FrameAllocator<const ORDER: usize = 32> {

impl<const ORDER: usize> FrameAllocator<ORDER> {
/// Create an empty frame allocator
pub fn new() -> Self {
pub const fn new() -> Self {
Self {
free_list: array::from_fn(|_| BTreeSet::default()),
free_list: [const { BTreeSet::new() }; ORDER],
allocated: 0,
total: 0,
}
Expand Down

0 comments on commit 95e5d6c

Please sign in to comment.