* [dpdk-dev] [PATCH] pipeline: use unsigned constants for left shift operations
@ 2016-03-10 13:49 Panu Matilainen
2016-03-10 14:27 ` Dumitrescu, Cristian
2016-03-13 15:19 ` Thomas Monjalon
0 siblings, 2 replies; 4+ messages in thread
From: Panu Matilainen @ 2016-03-10 13:49 UTC (permalink / raw)
To: 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 <pmatilai@redhat.com>
---
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;
--
2.5.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] pipeline: use unsigned constants for left shift operations
2016-03-10 13:49 [dpdk-dev] [PATCH] pipeline: use unsigned constants for left shift operations Panu Matilainen
@ 2016-03-10 14:27 ` Dumitrescu, Cristian
2016-03-13 15:23 ` Thomas Monjalon
2016-03-13 15:19 ` Thomas Monjalon
1 sibling, 1 reply; 4+ messages in thread
From: Dumitrescu, Cristian @ 2016-03-10 14:27 UTC (permalink / raw)
To: Panu Matilainen, dev
> -----Original Message-----
> From: Panu Matilainen [mailto:pmatilai@redhat.com]
> Sent: Thursday, March 10, 2016 1:50 PM
> To: dev@dpdk.org
> Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>
> Subject: [PATCH] pipeline: use unsigned constants for left shift operations
>
> 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 <pmatilai@redhat.com>
> ---
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] pipeline: use unsigned constants for left shift operations
2016-03-10 14:27 ` Dumitrescu, Cristian
@ 2016-03-13 15:23 ` Thomas Monjalon
0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2016-03-13 15:23 UTC (permalink / raw)
To: Panu Matilainen; +Cc: dev, Dumitrescu, Cristian
> > 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 <pmatilai@redhat.com>
>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Applied with typo fixed, thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] pipeline: use unsigned constants for left shift operations
2016-03-10 13:49 [dpdk-dev] [PATCH] pipeline: use unsigned constants for left shift operations Panu Matilainen
2016-03-10 14:27 ` Dumitrescu, Cristian
@ 2016-03-13 15:19 ` Thomas Monjalon
1 sibling, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2016-03-13 15:19 UTC (permalink / raw)
To: Panu Matilainen; +Cc: dev
2016-03-10 15:49, Panu Matilainen:
> --- 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);
Typo: should be 0U.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-03-13 15:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-10 13:49 [dpdk-dev] [PATCH] pipeline: use unsigned constants for left shift operations Panu Matilainen
2016-03-10 14:27 ` Dumitrescu, Cristian
2016-03-13 15:23 ` Thomas Monjalon
2016-03-13 15:19 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).