Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3517517pxb; Mon, 24 Jan 2022 11:13:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJwckIwRV/0+TiEtzqHuw2L2c4LjTi03qlcuHf2SNMLShu8WQ80NWEA7HWEg2W4jgL/xsNjv X-Received: by 2002:a17:902:e846:b0:14b:43f7:a6df with SMTP id t6-20020a170902e84600b0014b43f7a6dfmr7813171plg.171.1643051595613; Mon, 24 Jan 2022 11:13:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643051595; cv=none; d=google.com; s=arc-20160816; b=eLrvU/4X5BLZn3RlpATCNdwIWkUavcazRFjyeIRg7EeuwTdsN7Di1c2hU17d967lQ9 yKidfH4nCwijPGeLtDVX1Qr1cQTJj3ZL79gMWF1hQc7j+hhkl0m51gNHV5xFrEkDlETN a4oiJDS78CDkhOh/jHxh9/mOX4Npt/pEjrnrsf+juf0OAEjmEcDqmswWvNKEPIT+OaLQ eGwN3jx7xu0/IZ1jcJPNfrLK+KSocbOEjnka6RR8Iw7kcMWNqaFM0OivKAeJPAeTkyne 0ExYgX7LPek/3EBBfC7HAdwljZNQjOdsqOPyNmYRE5xJ8b6aFFvr6V45aULrweFcGybf 9bxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=2zlEN+yYvDtQGi3toJYPYGI161ABYjGg4q3c9JMRoQ0=; b=oJqWI9ENqIqRvCwDa9bAgo8TKI2R9kLSbOzxXuOVK+DYps2Mj0lwjV4mQq6esZCd7+ UyYPa/S1/Bn5wt/xoGWxHdr3s8lUYGtbTbe10cXuCiOWv6O4rW/F42NbTqPVh5zUDNzd g6v/CYxglPEP41qt8aivAdiLA0NdKHi+WvChA+3D9t/4IzY/JAdRF6hhPw0jZKWxHOGD QotvJJVTG728hnAthwDaIkOUoH71SWu8QGl1MFbqecnX1Uq4KUNzUlM3iCvzWClHVdw7 dXX+xh6j4VhKnh8Jd9Uf1M+ld81Eh0TQi2AKOkvJ6eEE756NO+QuDXdmVh0JI9iulF7y Xelg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=eAzSfwKy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 4si5647508pli.66.2022.01.24.11.13.02; Mon, 24 Jan 2022 11:13:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=eAzSfwKy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241691AbiAXMoo (ORCPT + 99 others); Mon, 24 Jan 2022 07:44:44 -0500 Received: from mga11.intel.com ([192.55.52.93]:1399 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239476AbiAXMom (ORCPT ); Mon, 24 Jan 2022 07:44:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643028282; x=1674564282; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=wpyH6xBCGYGqD5iKqVi6uZSO5z87rUEfXYqTwajDbh8=; b=eAzSfwKyXccveLYa+QvHHBQwqJeavLcx03qUeBSOYPreQc4fxHzgWRV0 MMxKCm83b+F/MQ/0DhXN8cXXBbk5KvghiZkXSNSiG/mfzlOI6I1GGgRQB dNjYwMs6wSvaAGeK8P0dL8VJPrnUWdUM9E7882qgCMp46HzHn1nebwRz0 q4Uzotu7Lklsg/CWjXV37vR26YBtzTAKL0wmMTvOPluGL98euWf7Zi4+M EEhbNymx1w9Maul8fr8Z31VLWNaDh74VFMlubmzU0uFy5On++JJEyvjS9 VM+cga5A2xzSp6EWh2n6K/mA+IYaCK2mOIyAnnQB5gGTQ1mvlRNMSyUwf Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10236"; a="243631494" X-IronPort-AV: E=Sophos;i="5.88,311,1635231600"; d="scan'208";a="243631494" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2022 04:44:41 -0800 X-IronPort-AV: E=Sophos;i="5.88,311,1635231600"; d="scan'208";a="562645121" Received: from smile.fi.intel.com ([10.237.72.61]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2022 04:44:38 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1nByh0-00DtEW-O1; Mon, 24 Jan 2022 14:43:30 +0200 Date: Mon, 24 Jan 2022 14:43:30 +0200 From: Andy Shevchenko To: Yury Norov Cc: Rasmus Villemoes , Andrew Morton , =?utf-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= , Greg Kroah-Hartman , Peter Zijlstra , David Laight , Joe Perches , Dennis Zhou , Emil Renner Berthing , Nicholas Piggin , Matti Vaittinen , Alexey Klimov , linux-kernel@vger.kernel.org Subject: Re: [PATCH 27/54] lib/bitmap: add bitmap_weight_{cmp, eq, gt, ge, lt, le} functions Message-ID: References: <20220123183925.1052919-1-yury.norov@gmail.com> <20220123183925.1052919-28-yury.norov@gmail.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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 24, 2022 at 02:41:38PM +0200, Andy Shevchenko wrote: > On Sun, Jan 23, 2022 at 10:38:58AM -0800, Yury Norov wrote: ... > > + if (num > (int)nbits || num < 0) > > Wonder if > > if (abs(num) > nbits) > > would be sufficient. Scratch it. Of course it won't work. It may be other way around: if ((unsigned int)num > nbits) > > + return -num; -- With Best Regards, Andy Shevchenko