From patchwork Thu Mar 10 13:49:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Panu Matilainen X-Patchwork-Id: 11403 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id C23842BEA; Thu, 10 Mar 2016 14:50:05 +0100 (CET) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id A8F422BDB for ; Thu, 10 Mar 2016 14:50:03 +0100 (CET) Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 31928720A0; Thu, 10 Mar 2016 13:50:03 +0000 (UTC) Received: from sopuli.koti.laiskiainen.org.com (vpn1-4-209.ams2.redhat.com [10.36.4.209]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2ADo1pJ019242; Thu, 10 Mar 2016 08:50:02 -0500 From: Panu Matilainen To: dev@dpdk.org Date: Thu, 10 Mar 2016 15:49:55 +0200 Message-Id: <596c08913453daea0e9c98f25befba923a961216.1457617795.git.pmatilai@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 10 Mar 2016 13:50:03 +0000 (UTC) Subject: [dpdk-dev] [PATCH] pipeline: use unsigned constants for left shift operations X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Tell the compiler to use unsigned constants for left shift ops, otherwise building with gcc >= 6.0 fails due to multiple warnings like: warning: left shift of negative value [-Wshift-negative-value] Signed-off-by: Panu Matilainen Acked-by: Cristian Dumitrescu --- examples/ip_pipeline/pipeline/pipeline_common_fe.c | 4 ++-- examples/ip_pipeline/pipeline/pipeline_firewall.c | 4 ++-- examples/ip_pipeline/pipeline/pipeline_routing.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/ip_pipeline/pipeline/pipeline_common_fe.c b/examples/ip_pipeline/pipeline/pipeline_common_fe.c index bffc9a4..a691d42 100644 --- a/examples/ip_pipeline/pipeline/pipeline_common_fe.c +++ b/examples/ip_pipeline/pipeline/pipeline_common_fe.c @@ -337,7 +337,7 @@ app_link_config(struct app_params *app, return -1; } - netmask = (~0) << (32 - depth); + netmask = (~0U) << (32 - depth); host = ip & netmask; bcast = host | (~netmask); @@ -889,7 +889,7 @@ print_link_info(struct app_link_params *p) { struct rte_eth_stats stats; struct ether_addr *mac_addr; - uint32_t netmask = (~0) << (32 - p->depth); + uint32_t netmask = (~0U) << (32 - p->depth); uint32_t host = p->ip & netmask; uint32_t bcast = host | (~netmask); diff --git a/examples/ip_pipeline/pipeline/pipeline_firewall.c b/examples/ip_pipeline/pipeline/pipeline_firewall.c index 3d7ea7a..320b25d 100644 --- a/examples/ip_pipeline/pipeline/pipeline_firewall.c +++ b/examples/ip_pipeline/pipeline/pipeline_firewall.c @@ -256,10 +256,10 @@ app_pipeline_firewall_key_check_and_normalize(struct pipeline_firewall_key *key) return -1; if (src_ip_depth) - src_ip_netmask = (~0) << (32 - src_ip_depth); + src_ip_netmask = (~0U) << (32 - src_ip_depth); if (dst_ip_depth) - dst_ip_netmask = ((~0) << (32 - dst_ip_depth)); + dst_ip_netmask = ((~0U) << (32 - dst_ip_depth)); key->key.ipv4_5tuple.src_ip &= src_ip_netmask; key->key.ipv4_5tuple.dst_ip &= dst_ip_netmask; diff --git a/examples/ip_pipeline/pipeline/pipeline_routing.c b/examples/ip_pipeline/pipeline/pipeline_routing.c index 6354730..62a5eec 100644 --- a/examples/ip_pipeline/pipeline/pipeline_routing.c +++ b/examples/ip_pipeline/pipeline/pipeline_routing.c @@ -319,7 +319,7 @@ app_pipeline_routing_add_route(struct app_params *app, if ((depth == 0) || (depth > 32)) return -1; - netmask = (~0) << (32 - depth); + netmask = (~U0) << (32 - depth); key->key.ipv4.ip &= netmask; /* data */ @@ -421,7 +421,7 @@ app_pipeline_routing_delete_route(struct app_params *app, if ((depth == 0) || (depth > 32)) return -1; - netmask = (~0) << (32 - depth); + netmask = (~0U) << (32 - depth); key->key.ipv4.ip &= netmask; } break;