add a pointer_size method to Memory for easy access

This commit is contained in:
Oliver Schneider 2016-06-23 09:59:16 +02:00
parent 205a988c1b
commit d13153c424
No known key found for this signature in database
GPG key ID: 56D6EEA0FC67AC46

View file

@ -6,7 +6,7 @@ use std::{fmt, iter, mem, ptr};
use rustc::hir::def_id::DefId;
use rustc::ty::BareFnTy;
use rustc::ty::subst::Substs;
use rustc::ty::layout::{Size, TargetDataLayout};
use rustc::ty::layout::TargetDataLayout;
use error::{EvalError, EvalResult};
use primval::PrimVal;
@ -155,6 +155,10 @@ impl<'a, 'tcx> Memory<'a, 'tcx> {
Ok(())
}
pub fn pointer_size(&self) -> usize {
self.layout.pointer_size.bytes() as usize
}
}
/// Allocation accessors