From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CD678A0542; Wed, 5 Oct 2022 11:02:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6B2B240A7D; Wed, 5 Oct 2022 11:02:50 +0200 (CEST) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) by mails.dpdk.org (Postfix) with ESMTP id A9CEB40694 for ; Wed, 5 Oct 2022 11:02:49 +0200 (CEST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id F05C45C00C5; Wed, 5 Oct 2022 05:02:48 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Wed, 05 Oct 2022 05:02:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1664960568; x= 1665046968; bh=graCNnmb6LqCpFaDqxHoU1xJ5ME+KeD348yG5KB6X98=; b=s keVkvjd8kXkMaLOIC7U9mIJt6qx9YZ3/LPgHTZmzxBMxcgsd5Dl+NR71HWudvDrm VHYZJkOV9n7XotqF2DIvEGklxqkAE9CXgAuFdiz8mOXZCfWl+o77WYA8VywaVHwR 8Gx6zVG9CWKJhSthEUw/Aniync/uD88gn3ObvWESV2IhH75hdQzLQt8Qr2z2wUeM Y9ftiUANuUUhiuJxawB/nqXRYQIYyfI7AShZppOXlGHPQtnukRj+Ss7V11FnsqpS LL4ZkwMObq/DRhBTQiHMdwSNgnp2AmKyqW1MD+Bfs+P53q3IS2okiqvj7uVP9nQY cF+GaSWMo2z0wfuphFfFA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1664960568; x= 1665046968; bh=graCNnmb6LqCpFaDqxHoU1xJ5ME+KeD348yG5KB6X98=; b=e W6updM/8WydY6HLOiV6KefdURvZjtGDhphxrEa7X60Luj5LNh8X5HMDysreEcvqn ZZ2F40cZomubu0WyylVtrILUP5A3McWcp6AEphYgn88RK3VypZX5g1Wcf57UP9ws /YXr7NYDN9NCkj1TkbYxzMdd2s1IAytDHhGtA+YlFnK+hnBkOR9jJ5U8yP/SXdBS QgsT7avG1526dqcHAaAf0jpAke+A+ul8s3C2GtXTL0xrqeAO0/OHxpcvF/Stk0s5 17uw1UOMMNZr7oo4WbrAz+QSSFrh7JLf81X1W/FvrkJyy9dS9jfibVlJuIHEUeUP AN5CuIu0/+Vx3wqMPpZzw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeeifedguddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufffkfgjfhgggfgtsehtuf ertddttddvnecuhfhrohhmpefvhhhomhgrshcuofhonhhjrghlohhnuceothhhohhmrghs sehmohhnjhgrlhhonhdrnhgvtheqnecuggftrfgrthhtvghrnheptdejieeifeehtdffgf dvleetueeffeehueejgfeuteeftddtieekgfekudehtdfgnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhhonh drnhgvth X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 5 Oct 2022 05:02:47 -0400 (EDT) From: Thomas Monjalon To: Tyler Retzlaff Cc: dev@dpdk.org, anatoly.burakov@intel.com, ranjit.menon@intel.com, mb@smartsharesystems.com, Tyler Retzlaff , stephen@networkplumber.org Subject: Re: [PATCH 2/3] eal: change rte_fls and rte_bsf to return uint32_t Date: Wed, 05 Oct 2022 11:02:45 +0200 Message-ID: <1849229.jbyF5MZJ3u@thomas> In-Reply-To: <1659993692-17479-3-git-send-email-roretzla@linux.microsoft.com> References: <1615418650-19513-1-git-send-email-roretzla@linux.microsoft.com> <1659993692-17479-1-git-send-email-roretzla@linux.microsoft.com> <1659993692-17479-3-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 08/08/2022 23:21, Tyler Retzlaff: > From: Tyler Retzlaff > > return fixed width uint32_t to be consistent with what appears to > be the original authors intent. it doesn't make much sense to return > signed integers for these functions. > > Signed-off-by: Tyler Retzlaff > --- > lib/eal/include/rte_common.h | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h > index a96cc2a..bd4184d 100644 > --- a/lib/eal/include/rte_common.h > +++ b/lib/eal/include/rte_common.h > @@ -707,7 +707,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) > * @return > * The last (most-significant) bit set, or 0 if the input is 0. > */ > -static inline int > +static inline uint32_t > rte_fls_u32(uint32_t x) > { > return (x == 0) ? 0 : 32 - __builtin_clz(x); > @@ -724,7 +724,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) > * @return > * least significant set bit in the input parameter. > */ > -static inline int > +static inline uint32_t > rte_bsf64(uint64_t v) > { > return (uint32_t)__builtin_ctzll(v); > @@ -766,7 +766,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) > * @return > * The last (most-significant) bit set, or 0 if the input is 0. > */ > -static inline int > +static inline uint32_t > rte_fls_u64(uint64_t x) > { > return (x == 0) ? 0 : 64 - __builtin_clzll(x); > You forgot the _safe versions: --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -660,7 +660,7 @@ rte_bsf32(uint32_t v) * @return * Returns 0 if ``v`` was 0, otherwise returns 1. */ -static inline int +static inline uint32_t rte_bsf32_safe(uint32_t v, uint32_t *pos) { if (v == 0) @@ -739,7 +739,7 @@ rte_bsf64(uint64_t v) * @return * Returns 0 if ``v`` was 0, otherwise returns 1. */ -static inline int +static inline uint32_t rte_bsf64_safe(uint64_t v, uint32_t *pos) { if (v == 0)