Skip to content
Snippets Groups Projects
Verified Commit f016441c authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

chore: small code change

parent d4fff4f3
No related branches found
No related tags found
No related merge requests found
Pipeline #4898 passed
......@@ -7,20 +7,6 @@ use crate::gb::GameBoy;
static mut GLOBAL_INSTANCE: *const GameBoy = null();
impl GameBoy {
/// Obtains the global instance of the Game Boy emulator
/// ready to be used in diagnostics.
///
/// If the global instance is not set, it will return `None`.
fn global() -> Option<&'static Self> {
unsafe {
if GLOBAL_INSTANCE.is_null() {
None
} else {
Some(&*GLOBAL_INSTANCE)
}
}
}
/// Sets the current instance as the one going to be used
/// in panic diagnostics.
pub fn set_diag(&self) {
......@@ -35,6 +21,20 @@ impl GameBoy {
}
}
/// Obtains the global instance of the Game Boy emulator
/// ready to be used in diagnostics.
///
/// If the global instance is not set, it will return `None`.
fn global() -> Option<&'static Self> {
unsafe {
if GLOBAL_INSTANCE.is_null() {
None
} else {
Some(&*GLOBAL_INSTANCE)
}
}
}
/// Sets the current instance as the global one going to
/// be used in panic diagnostics.
fn set_global(&self) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment