Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3C3CC43331 for ; Sun, 29 Mar 2020 13:48:24 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B23342073B for ; Sun, 29 Mar 2020 13:48:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=xen.org header.i=@xen.org header.b="YUSWvkb+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B23342073B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jIYIO-00040p-V6; Sun, 29 Mar 2020 13:48:12 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jIYIN-00040j-Ae for xen-devel@lists.xenproject.org; Sun, 29 Mar 2020 13:48:11 +0000 X-Inumbo-ID: edaefc7c-71c3-11ea-a6c1-bc764e2007e4 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id edaefc7c-71c3-11ea-a6c1-bc764e2007e4; Sun, 29 Mar 2020 13:48:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID :Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe :List-Post:List-Owner:List-Archive; bh=m1bcCwdKmlFYgDQ3tPtffzYzRQyRLoHt47xgDRxIpA0=; b=YUSWvkb+fRE457VwYehASH/G90 w6zen5BwWS+24mbyGwtbRib9EATSI3bA4HFUg5tdAKg2uRiU27zHLH0XCy67jiowqxil2hyLjGF0t vTsuMrk5zuyaCIMNlylBjIhRuLhLhHiiuQE1RZRpT2EETZzTNtgBSy+TGEl8EyPC1sGs=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jIYIJ-0003mY-SX; Sun, 29 Mar 2020 13:48:07 +0000 Received: from 44.142.6.51.dyn.plus.net ([51.6.142.44] helo=debian) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1jIYIJ-0001n6-Jt; Sun, 29 Mar 2020 13:48:07 +0000 Date: Sun, 29 Mar 2020 14:48:04 +0100 From: Wei Liu To: Julien Grall Message-ID: <20200329134804.6butjlnonib54ren@debian> References: <20200329072242.GA1394@simran-Inspiron-5558> <6f04a17f-610e-1370-7aed-446f46472bc2@xen.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6f04a17f-610e-1370-7aed-446f46472bc2@xen.org> User-Agent: NeoMutt/20180716 Subject: Re: [Xen-devel] [PATCH] xen/x86: Use min macro instead of ternary operator X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Kevin Tian , Jun Nakajima , Wei Liu , Andrew Cooper , George Dunlap , Jan Beulich , xen-devel@lists.xenproject.org, Simran Singhal , Roger Pau =?utf-8?B?TW9ubsOp?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On Sun, Mar 29, 2020 at 12:08:39PM +0100, Julien Grall wrote: > Hi, > > On 29/03/2020 08:22, Simran Singhal wrote: > > Replace ternary operator with macro min as it is shorter and > > thus increases code readability. Macro min return the minimum of the > > two compared values. > > While I understand the ternary operator is doing exactly the same as a > min(), I read the current code as "If there is an error then return the > error code, otherwise return 0". > > This is quite different from the meaning of "min" which is "I want the > minimum of the two values". Therefore I am not convinced using min() is the > right thing to do. I agree with Julien's assessment. Wei.