From 62c5083f300f4be76d3655bcfd4945b2ac608e2e Mon Sep 17 00:00:00 2001 From: Scott Olson Date: Sun, 20 Mar 2016 20:33:46 -0600 Subject: [PATCH] Reduce duplication for integer reprs. --- src/interpreter.rs | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/interpreter.rs b/src/interpreter.rs index 20722dced62f..188c0590e52a 100644 --- a/src/interpreter.rs +++ b/src/interpreter.rs @@ -743,17 +743,14 @@ impl<'a, 'tcx: 'a, 'arena> Interpreter<'a, 'tcx, 'arena> { use syntax::ast::{IntTy, UintTy}; let repr = match ty.sty { ty::TyBool => Repr::Primitive { size: 1 }, - ty::TyInt(IntTy::Is) => Repr::Primitive { size: self.memory.pointer_size }, - ty::TyInt(IntTy::I8) => Repr::Primitive { size: 1 }, - ty::TyInt(IntTy::I16) => Repr::Primitive { size: 2 }, - ty::TyInt(IntTy::I32) => Repr::Primitive { size: 4 }, - ty::TyInt(IntTy::I64) => Repr::Primitive { size: 8 }, - ty::TyUint(UintTy::Us) => Repr::Primitive { size: self.memory.pointer_size }, - ty::TyUint(UintTy::U8) => Repr::Primitive { size: 1 }, - ty::TyUint(UintTy::U16) => Repr::Primitive { size: 2 }, - ty::TyUint(UintTy::U32) => Repr::Primitive { size: 4 }, - ty::TyUint(UintTy::U64) => Repr::Primitive { size: 8 }, + ty::TyInt(IntTy::I8) | ty::TyUint(UintTy::U8) => Repr::Primitive { size: 1 }, + ty::TyInt(IntTy::I16) | ty::TyUint(UintTy::U16) => Repr::Primitive { size: 2 }, + ty::TyInt(IntTy::I32) | ty::TyUint(UintTy::U32) => Repr::Primitive { size: 4 }, + ty::TyInt(IntTy::I64) | ty::TyUint(UintTy::U64) => Repr::Primitive { size: 8 }, + + ty::TyInt(IntTy::Is) | ty::TyUint(UintTy::Us) => + Repr::Primitive { size: self.memory.pointer_size }, ty::TyTuple(ref fields) => self.make_aggregate_repr(iter::once(fields.iter().cloned())),