mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
use addr_of_mut rather than mut reference
This commit is contained in:
parent
5e711ebb5f
commit
1132bc2383
|
@ -387,6 +387,8 @@ pub(crate) fn program_counter_before_interrupt() -> u32 {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod test {
|
mod test {
|
||||||
|
use core::ptr::addr_of_mut;
|
||||||
|
|
||||||
use super::Gba;
|
use super::Gba;
|
||||||
|
|
||||||
#[test_case]
|
#[test_case]
|
||||||
|
@ -415,11 +417,11 @@ mod test {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[link_section = ".ewram"]
|
#[link_section = ".ewram"]
|
||||||
static mut EWRAM_TEST: u32 = 5;
|
static mut EWART_TEST: u32 = 5;
|
||||||
#[test_case]
|
#[test_case]
|
||||||
fn ewram_static_test(_gba: &mut Gba) {
|
fn ewram_static_test(_gba: &mut Gba) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ewram_ptr = &mut EWRAM_TEST as *mut u32;
|
let ewram_ptr = addr_of_mut!(EWART_TEST);
|
||||||
let content = ewram_ptr.read_volatile();
|
let content = ewram_ptr.read_volatile();
|
||||||
assert_eq!(content, 5, "expected data in ewram to be 5");
|
assert_eq!(content, 5, "expected data in ewram to be 5");
|
||||||
ewram_ptr.write_volatile(content + 1);
|
ewram_ptr.write_volatile(content + 1);
|
||||||
|
@ -438,7 +440,7 @@ mod test {
|
||||||
#[test_case]
|
#[test_case]
|
||||||
fn iwram_explicit_test(_gba: &mut Gba) {
|
fn iwram_explicit_test(_gba: &mut Gba) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let iwram_ptr = &mut IWRAM_EXPLICIT as *mut u32;
|
let iwram_ptr = addr_of_mut!(IWRAM_EXPLICIT);
|
||||||
let address = iwram_ptr as usize;
|
let address = iwram_ptr as usize;
|
||||||
assert!(
|
assert!(
|
||||||
(0x0300_0000..0x0300_8000).contains(&address),
|
(0x0300_0000..0x0300_8000).contains(&address),
|
||||||
|
@ -456,7 +458,7 @@ mod test {
|
||||||
#[test_case]
|
#[test_case]
|
||||||
fn implicit_data_test(_gba: &mut Gba) {
|
fn implicit_data_test(_gba: &mut Gba) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let iwram_ptr = &mut IMPLICIT_STORAGE as *mut u32;
|
let iwram_ptr = addr_of_mut!(IMPLICIT_STORAGE);
|
||||||
let address = iwram_ptr as usize;
|
let address = iwram_ptr as usize;
|
||||||
assert!(
|
assert!(
|
||||||
(0x0200_0000..0x0204_0000).contains(&address),
|
(0x0200_0000..0x0204_0000).contains(&address),
|
||||||
|
|
Loading…
Reference in a new issue