mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-12 01:51:34 +11:00
Remove the need for this to be mut and write it in a more 'rusty' way
This commit is contained in:
parent
22c6efa5fa
commit
cd4718f8c5
|
@ -28,11 +28,11 @@ impl BumpAllocator {
|
||||||
fn alloc_safe(&self, layout: Layout) -> *mut u8 {
|
fn alloc_safe(&self, layout: Layout) -> *mut u8 {
|
||||||
let mut current_ptr = self.current_ptr.lock();
|
let mut current_ptr = self.current_ptr.lock();
|
||||||
|
|
||||||
let mut ptr = *current_ptr as usize;
|
let ptr = if current_ptr.is_null() {
|
||||||
|
get_data_end()
|
||||||
if ptr == 0 {
|
} else {
|
||||||
ptr = get_data_end();
|
*current_ptr as usize
|
||||||
}
|
};
|
||||||
|
|
||||||
let alignment_bitmask = layout.align() - 1;
|
let alignment_bitmask = layout.align() - 1;
|
||||||
let fixup = ptr & alignment_bitmask;
|
let fixup = ptr & alignment_bitmask;
|
||||||
|
|
Loading…
Reference in a new issue