mirror of
https://github.com/italicsjenga/agb.git
synced 2025-01-11 17:41:33 +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 {
|
||||
let mut current_ptr = self.current_ptr.lock();
|
||||
|
||||
let mut ptr = *current_ptr as usize;
|
||||
|
||||
if ptr == 0 {
|
||||
ptr = get_data_end();
|
||||
}
|
||||
let ptr = if current_ptr.is_null() {
|
||||
get_data_end()
|
||||
} else {
|
||||
*current_ptr as usize
|
||||
};
|
||||
|
||||
let alignment_bitmask = layout.align() - 1;
|
||||
let fixup = ptr & alignment_bitmask;
|
||||
|
|
Loading…
Reference in a new issue