KVM: emulator: cleanup decode_register_operand() a bit
authorGleb Natapov <gleb@redhat.com>
Mon, 4 Nov 2013 13:52:42 +0000 (15:52 +0200)
committerGleb Natapov <gleb@redhat.com>
Tue, 5 Nov 2013 07:11:30 +0000 (09:11 +0200)
Make code shorter.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
arch/x86/kvm/emulate.c

index 0bd372f..07ffca0 100644 (file)
@@ -1045,13 +1045,9 @@ static void decode_register_operand(struct x86_emulate_ctxt *ctxt,
        }
 
        op->type = OP_REG;
-       if (ctxt->d & ByteOp) {
-               op->addr.reg = decode_register(ctxt, reg, true);
-               op->bytes = 1;
-       } else {
-               op->addr.reg = decode_register(ctxt, reg, false);
-               op->bytes = ctxt->op_bytes;
-       }
+       op->bytes = (ctxt->d & ByteOp) ? 1 : ctxt->op_bytes;
+       op->addr.reg = decode_register(ctxt, reg, ctxt->d & ByteOp);
+
        fetch_register_operand(op);
        op->orig_val = op->val;
 }