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 251E245E33; Wed, 4 Dec 2024 23:59:45 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B272B402AF; Wed, 4 Dec 2024 23:59:44 +0100 (CET) Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by mails.dpdk.org (Postfix) with ESMTP id C57D84029B for ; Wed, 4 Dec 2024 23:59:43 +0100 (CET) Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-2155157c58cso1771445ad.0 for ; Wed, 04 Dec 2024 14:59:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1733353182; x=1733957982; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=dF5PxXkwR1Xc0dXSf1yxaFL8I5lvq1LNdqwDiMhkjtQ=; b=YowKLLL99wPytOJ0GAGPvwyt++EmKAmS+T8V3PC7HmuXj7W0QIL+kwlj/0/XjotGZL cOtzvsxDQDUUzRB0nSOHOdb9U5GzRY1PH3WP6LpwNh8elF5OJKXCghDAK6p1LRO41dOM s5APAUjANwtQrvDcE6+bPAv/loPaNTRzbJoIwl5kIClkDbLHh3cL2nUEl3XAg4pOaxwu sbwTQcqOXBhlhr14dxBqEOGYZarte0cKUnVWM8vkqazLRcmmLfy6jU+wjW6Xb4+rrlmk y+3V5BwCD/6szzH2Zm8L2OYZZs06Rx00Yw2kpl4R/NicI3+QJUDFZ6X4I42jV/oxjU7x EDqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733353182; x=1733957982; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dF5PxXkwR1Xc0dXSf1yxaFL8I5lvq1LNdqwDiMhkjtQ=; b=tjPMk3lsv3sNKp241+nT6VTtjNGP0bmFoC9OaD+9uNYdeshRWS8szV2agAKxBPGESE NnJ4TPft/VL3W93wc8AiYYm/DAUsIz+PeQbSqavB9nTqV4rAM3LP3bwcFHtpwjVQBJqT 6m4EWaheD7JOxfabJ1l4As7sBzYWqxiCaRL7SsrzEzkUeyzJ+p+2mU9gqZCTjfpeBe3Z bv9TA3PuBJhBmJ4O3xNA3be0NkZgoL5TY9AavQtdALZOegBEHoliVVzDK+vgAcdCMe/D aLQgGGtmdobtNJcrur4SXMtNNSZES5OlWzlxEukvnsj+ugnPJST/VGWt3/YSOwWO0rP5 XGQg== X-Forwarded-Encrypted: i=1; AJvYcCX5MqdM7cov3kKseez56uwZuMVaZd4h26XuHkX41NDpX+6E7ozQdEKfGQa1WkegMpxzJBs=@dpdk.org X-Gm-Message-State: AOJu0YyKcAV6JW1BKO5c1EnDGnVpSoEV0V0rGea6Ui4GQiv92Fho/n1R jhqoe/NdbxY4TAjI3o7QPNlOKLRfrHQVlyEQ40D5yeRKgDbApROknx416iSRp0Q= X-Gm-Gg: ASbGncv+i2/A267670PJbhU22oRrd65KZylL875Jlb0TcGci4OyRvb9kwd6aVY6jSgG Jj844WZJs7jlWEK+/plteEPdGZnFeDKV0EvMTUqHdBsHpGCV7Pi5L9IG2+YKyE/BYqyQVZoQLvA XgEzwUYacW80V1MyvW2bXS7d2fk3Ytwoqmg4HgrQLTiAxj//moQoCL3qFgpZ6x56LYMGCocfnGN L3nE3gKflT7z77M0hLIdO2FilBwQmPlNd05eyHsBMew0HR+l9CyLUEew3/H8b053fr4tW3YPyR/ wV7j6T6zeWlzdpajhHJQsY2EncE= X-Google-Smtp-Source: AGHT+IHpjks96boPFvhhfLjiJFWJwbg1SyNlRRqe8GlSCvMiLuC1o4EPT3QxTTsnhMaHaVb8jwIlkA== X-Received: by 2002:a17:902:ce8b:b0:215:711f:4974 with SMTP id d9443c01a7336-215bd192916mr97292525ad.55.1733353182683; Wed, 04 Dec 2024 14:59:42 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-215f8f29b35sm588035ad.252.2024.12.04.14.59.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Dec 2024 14:59:42 -0800 (PST) Date: Wed, 4 Dec 2024 14:59:40 -0800 From: Stephen Hemminger To: Andre Muezerie Cc: Vladimir Medvedkin , dev@dpdk.org Subject: Re: [PATCH] lib/fib: remove warning about implicit 64-bit conversion Message-ID: <20241204145940.25cd99ea@hermes.local> In-Reply-To: <1733281010-23780-1-git-send-email-andremue@linux.microsoft.com> References: <1733281010-23780-1-git-send-email-andremue@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 On Tue, 3 Dec 2024 18:56:50 -0800 Andre Muezerie wrote: > MSVC issues the warning below: > > ../lib/fib/trie.c(341): warning C4334: '<<': > result of 32-bit shift implicitly converted to 64 bits > (was 64-bit shift intended?) > > The fix is to cast the result explicitly to ptrdiff_t since it is used > in pointer arithmetic. > > Signed-off-by: Andre Muezerie > --- > lib/fib/trie.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/lib/fib/trie.c b/lib/fib/trie.c > index 4893f6c636..997b7cc338 100644 > --- a/lib/fib/trie.c > +++ b/lib/fib/trie.c > @@ -338,7 +338,7 @@ write_edge(struct rte_trie_tbl *dp, const uint8_t *ip_part, uint64_t next_hop, > if (ret < 0) > return ret; > if (edge == LEDGE) { > - write_to_dp((uint8_t *)p + (1 << dp->nh_sz), > + write_to_dp((uint8_t *)p + (ptrdiff_t)(1 << dp->nh_sz), > next_hop << 1, dp->nh_sz, UINT8_MAX - *ip_part); You would be better to use a 64 bit shift or RTE_BIT64 for this. write_to_dp((uint8_t *)p + ((uintptr_t)1 << dp->nh_sz),