Skip to content

Commit

Permalink
Simplify cast_ptr.
Browse files Browse the repository at this point in the history
  • Loading branch information
solson committed Nov 7, 2016
1 parent a8d90ff commit 2d4301e
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions src/interpreter/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
match ty.sty {
TyRef(..) | TyRawPtr(_) => Ok(PrimVal::from_ptr(ptr)),
TyFnPtr(_) => Ok(PrimVal::from_fn_ptr(ptr)),

TyInt(IntTy::I8) |
TyInt(IntTy::I16) |
TyInt(IntTy::I32) |
TyInt(IntTy::I64) |
TyInt(IntTy::Is) |
TyUint(UintTy::U8) |
TyUint(UintTy::U16) |
TyUint(UintTy::U32) |
TyUint(UintTy::U64) |
TyUint(UintTy::Us) => {
let val = PrimVal::from_ptr(ptr);
self.transmute_primval(val, ty)
}

TyInt(_) | TyUint(_) => self.transmute_primval(PrimVal::from_ptr(ptr), ty),
_ => Err(EvalError::Unimplemented(format!("ptr to {:?} cast", ty))),
}
}
Expand Down

0 comments on commit 2d4301e

Please sign in to comment.