From mboxrd@z Thu Jan 1 00:00:00 1970 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=-4.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 395F0C433DF for ; Fri, 14 Aug 2020 15:39:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1D4B12074D for ; Fri, 14 Aug 2020 15:39:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726745AbgHNPjZ (ORCPT ); Fri, 14 Aug 2020 11:39:25 -0400 Received: from mga14.intel.com ([192.55.52.115]:44094 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726596AbgHNPjY (ORCPT ); Fri, 14 Aug 2020 11:39:24 -0400 IronPort-SDR: w3Fm7uUW3qYoDrGeFt/spNQ9P2w4CKSuYX6Tn15lO8hN0TEWuzOpBuAiizAffdPCsGOb8Ugy/L bNIwcWVVxAfw== X-IronPort-AV: E=McAfee;i="6000,8403,9713"; a="153667526" X-IronPort-AV: E=Sophos;i="5.76,312,1592895600"; d="scan'208";a="153667526" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Aug 2020 08:39:23 -0700 IronPort-SDR: H/WLMhXf8+TVaikCN5jokFNI7+wY1Aa+3sgpEkkNvwGWfPPwNEpkF1dXTXp9w7yjVRsAAUcG05 mePWHfTBNIjw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,312,1592895600"; d="scan'208";a="325755107" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga008.jf.intel.com with ESMTP; 14 Aug 2020 08:39:22 -0700 Received: from andy by smile with local (Exim 4.94) (envelope-from ) id 1k6bnd-008g88-FT; Fri, 14 Aug 2020 18:39:21 +0300 Date: Fri, 14 Aug 2020 18:39:21 +0300 From: Andy Shevchenko To: "Rafael J. Wysocki" Cc: "Rafael J. Wysocki" , Len Brown , ACPI Devel Maling List Subject: Re: [PATCH v1 1/7] resource: Simplify region_intersects() by reducing conditionals Message-ID: <20200814153921.GT1891694@smile.fi.intel.com> References: <20200813175729.15088-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org On Fri, Aug 14, 2020 at 05:17:22PM +0200, Rafael J. Wysocki wrote: > On Thu, Aug 13, 2020 at 7:57 PM Andy Shevchenko > wrote: > > > > Now we have for 'other' and 'type' variables > > > > other type return > > 0 0 REGION_DISJOINT > > 0 x REGION_INTERSECTS > > x 0 REGION_DISJOINT > > x x REGION_MIXED > > > > Obviously it's easier to check 'type' for 0 first instead of > > currently checked 'other'. ... > > + return (other == 0) ? REGION_INTERSECTS : REGION_MIXED; > > The parens are not needed here. Right. > Also I would do > > if (other == 0) > REGION_INTERSECTS; > > return REGION_MIXED; Works for me, I'll update in v2. -- With Best Regards, Andy Shevchenko