From 65f3383d62a2d71147b322a04e723cda15f449a9 Mon Sep 17 00:00:00 2001 From: "Li, Fei1" Date: Mon, 14 Jan 2019 06:36:45 +0800 Subject: [PATCH] hv: coding style: remove unnecessary conditional operators Condtional operators which will add code cyclomatic complexity. So replace the unnecessary conditional operators. Tracked-On: #861 Signed-off-by: Li, Fei1 --- hypervisor/arch/x86/guest/instr_emul.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hypervisor/arch/x86/guest/instr_emul.c b/hypervisor/arch/x86/guest/instr_emul.c index 7e4d027ab..485ab3bbb 100644 --- a/hypervisor/arch/x86/guest/instr_emul.c +++ b/hypervisor/arch/x86/guest/instr_emul.c @@ -1737,10 +1737,10 @@ static int32_t decode_prefixes(struct instr_emul_vie *vie, enum vm_cpu_mode cpu_ */ if ((cpu_mode == CPU_MODE_64BIT) && (x >= 0x40U) && (x <= 0x4FU)) { vie->rex_present = 1U; - vie->rex_w = (x & 0x8U) != 0U ? 1U : 0U; - vie->rex_r = (x & 0x4U) != 0U ? 1U : 0U; - vie->rex_x = (x & 0x2U) != 0U ? 1U : 0U; - vie->rex_b = (x & 0x1U) != 0U ? 1U : 0U; + vie->rex_w = (x >> 0x3U) & 1U; + vie->rex_r = (x >> 0x2U) & 1U; + vie->rex_x = (x >> 0x1U) & 1U; + vie->rex_b = (x >> 0x0U) & 1U; vie_advance(vie); }