diff options
author | Determinant <ted.sybil@gmail.com> | 2018-01-08 19:54:41 +0800 |
---|---|---|
committer | Determinant <ted.sybil@gmail.com> | 2018-01-08 19:54:41 +0800 |
commit | d4b31544fcd3cd87077d6b5b32685dc885cd8d33 (patch) | |
tree | 9b795a2c18c8a4e44afe5c54e06653648d3633c7 /src/ppu.rs | |
parent | 704d1c2e7feb0501097e70032f951893d29e358a (diff) |
change size_of consts to macros to support stable rustc
Diffstat (limited to 'src/ppu.rs')
-rw-r--r-- | src/ppu.rs | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -1,7 +1,6 @@ #![allow(dead_code)] use memory::{VMem, PPUMemory, CPUBus}; -use core::intrinsics::transmute; -use core::mem::size_of; +use core::mem::{size_of, transmute}; use utils::{Read, Write, load_prefix, save_prefix}; pub trait Screen { @@ -62,9 +61,10 @@ pub struct PPU<'a> { pub scr: &'a mut Screen, } -const PPU_IGNORED_SIZE: usize = - size_of::<PPUMemory>() + - size_of::<&mut Screen>(); +macro_rules! PPU_IGNORED_SIZE { + () => (size_of::<PPUMemory>() + + size_of::<&mut Screen>()) +} impl<'a> PPU<'a> { #[inline] @@ -491,12 +491,12 @@ impl<'a> PPU<'a> { } pub fn load(&mut self, reader: &mut Read) -> bool { - load_prefix(self, PPU_IGNORED_SIZE, reader) && + load_prefix(self, PPU_IGNORED_SIZE!(), reader) && self.mem.load(reader) } pub fn save(&self, writer: &mut Write) -> bool { - save_prefix(self, PPU_IGNORED_SIZE, writer) && + save_prefix(self, PPU_IGNORED_SIZE!(), writer) && self.mem.save(writer) } |