Skip to content

Commit d13153c

Browse files
committed
add a pointer_size method to Memory for easy access
1 parent 205a988 commit d13153c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/memory.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::{fmt, iter, mem, ptr};
66
use rustc::hir::def_id::DefId;
77
use rustc::ty::BareFnTy;
88
use rustc::ty::subst::Substs;
9-
use rustc::ty::layout::{Size, TargetDataLayout};
9+
use rustc::ty::layout::TargetDataLayout;
1010

1111
use error::{EvalError, EvalResult};
1212
use primval::PrimVal;
@@ -155,6 +155,10 @@ impl<'a, 'tcx> Memory<'a, 'tcx> {
155155

156156
Ok(())
157157
}
158+
159+
pub fn pointer_size(&self) -> usize {
160+
self.layout.pointer_size.bytes() as usize
161+
}
158162
}
159163

160164
/// Allocation accessors

0 commit comments

Comments
 (0)