Received: from eggs.gnu.org ([2001:4830:134:3::10]:39930) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBKSW-0002hO-U0 for qemu-devel@nongnu.org; Wed, 14 Jan 2015 04:41:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YBKSQ-00008H-IL for qemu-devel@nongnu.org; Wed, 14 Jan 2015 04:41:52 -0500 Received: from mail-we0-x22d.google.com ([2a00:1450:400c:c03::22d]:58969) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YBKSQ-000086-BB for qemu-devel@nongnu.org; Wed, 14 Jan 2015 04:41:46 -0500 Received: by mail-we0-f173.google.com with SMTP id q58so7684230wes.4 for ; Wed, 14 Jan 2015 01:41:45 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Wed, 14 Jan 2015 10:41:21 +0100 Message-Id: <1421228492-19856-5-git-send-email-pbonzini@redhat.com> In-Reply-To: <1421228492-19856-1-git-send-email-pbonzini@redhat.com> References: <1421228492-19856-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PULL 04/15] vl: Avoid unnecessary 'if' nesting List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Eduardo Habkost From: Eduardo Habkost Just a coding style change, to make other changes easier to review. Signed-off-by: Eduardo Habkost Reviewed-by: Andrew Jones Signed-off-by: Paolo Bonzini --- vl.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/vl.c b/vl.c index 1a2da2b..56a17dd 100644 --- a/vl.c +++ b/vl.c @@ -1170,13 +1170,11 @@ static void smp_parse(QemuOpts *opts) if (cpus == 0) { cpus = cores * threads * sockets; } + } else if (cores == 0) { + threads = threads > 0 ? threads : 1; + cores = cpus / (sockets * threads); } else { - if (cores == 0) { - threads = threads > 0 ? threads : 1; - cores = cpus / (sockets * threads); - } else { - threads = cpus / (cores * sockets); - } + threads = cpus / (cores * sockets); } max_cpus = qemu_opt_get_number(opts, "maxcpus", 0); -- 1.8.3.1