From patchwork Tue Mar 9 23:44:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 88772 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8B3F6A0567; Wed, 10 Mar 2021 00:44:57 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 59E4822A2B5; Wed, 10 Mar 2021 00:44:57 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 2DCFA40687 for ; Wed, 10 Mar 2021 00:44:56 +0100 (CET) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 5EC4920B3754; Tue, 9 Mar 2021 15:44:55 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5EC4920B3754 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1615333495; bh=9j87K4CTLriOC2yDCHSNISmDO+qQ054dA9ud5JnjE3A=; h=From:To:Cc:Subject:Date:From; b=Xtx/A6Nmm/ucORZmCbZe7G/3awUfVEIHhClUAfvI14anPLz0nicnQMLHUfTuUDJB5 dB4uKIvpJBGR6BOesypkD7kgpZUkSFwK9CTUEWbPoPCmoC0L7hkO9gb87mZTHU4vwq plVFrTy98lfX+biwzPRc8aG7FtHTGPN+HCZ2/gt4= From: Tyler Retzlaff To: dev@dpdk.org Cc: anatoly.burakov@intel.com, david.hunt@intel.com Date: Tue, 9 Mar 2021 15:44:50 -0800 Message-Id: <1615333490-15243-1-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH] eal, power: don't use '-' sign with unsigned literals 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 Sender: "dev" use ~0ULL instead of -1ULL to avoid contridctory application of '-' sign to integer literal where the desired type is unsigned. Signed-off-by: Tyler Retzlaff --- lib/librte_eal/common/eal_common_fbarray.c | 12 ++++++------ lib/librte_power/rte_power_pmd_mgmt.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/librte_eal/common/eal_common_fbarray.c b/lib/librte_eal/common/eal_common_fbarray.c index 592ec5859..82d271725 100644 --- a/lib/librte_eal/common/eal_common_fbarray.c +++ b/lib/librte_eal/common/eal_common_fbarray.c @@ -138,7 +138,7 @@ find_next_n(const struct rte_fbarray *arr, unsigned int start, unsigned int n, */ last = MASK_LEN_TO_IDX(arr->len); last_mod = MASK_LEN_TO_MOD(arr->len); - last_msk = ~(-1ULL << last_mod); + last_msk = ~(~0ULL << last_mod); for (msk_idx = first; msk_idx < msk->n_masks; msk_idx++) { uint64_t cur_msk, lookahead_msk; @@ -398,8 +398,8 @@ find_prev_n(const struct rte_fbarray *arr, unsigned int start, unsigned int n, first_mod = MASK_LEN_TO_MOD(start); /* we're going backwards, so mask must start from the top */ ignore_msk = first_mod == MASK_ALIGN - 1 ? - -1ULL : /* prevent overflow */ - ~(-1ULL << (first_mod + 1)); + ~0ULL : /* prevent overflow */ + ~(~0ULL << (first_mod + 1)); /* go backwards, include zero */ msk_idx = first; @@ -513,7 +513,7 @@ find_prev_n(const struct rte_fbarray *arr, unsigned int start, unsigned int n, * no runs in the space we've lookbehind-scanned * as well, so skip that on next iteration. */ - ignore_msk = -1ULL << need; + ignore_msk = ~0ULL << need; msk_idx = lookbehind_idx; break; } @@ -560,8 +560,8 @@ find_prev(const struct rte_fbarray *arr, unsigned int start, bool used) first_mod = MASK_LEN_TO_MOD(start); /* we're going backwards, so mask must start from the top */ ignore_msk = first_mod == MASK_ALIGN - 1 ? - -1ULL : /* prevent overflow */ - ~(-1ULL << (first_mod + 1)); + ~0ULL : /* prevent overflow */ + ~(~0ULL << (first_mod + 1)); /* go backwards, include zero */ idx = first; diff --git a/lib/librte_power/rte_power_pmd_mgmt.c b/lib/librte_power/rte_power_pmd_mgmt.c index 454ef7091..579f10e4b 100644 --- a/lib/librte_power/rte_power_pmd_mgmt.c +++ b/lib/librte_power/rte_power_pmd_mgmt.c @@ -111,7 +111,7 @@ clb_umwait(uint16_t port_id, uint16_t qidx, struct rte_mbuf **pkts __rte_unused, ret = rte_eth_get_monitor_addr(port_id, qidx, &pmc); if (ret == 0) - rte_power_monitor(&pmc, -1ULL); + rte_power_monitor(&pmc, ~0ULL); } q_conf->umwait_in_progress = false;