From: Ben Pfaff Date: Tue, 31 Dec 2013 18:36:19 +0000 (-0800) Subject: odp-util: Simplify logic in odp_flow_key_to_flow__(). X-Git-Tag: sliver-openvswitch-2.1.90-1~9^2^2 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=21e70add7e5fc18c519ca3d46691230bf136b1e1;hp=-c;p=sliver-openvswitch.git odp-util: Simplify logic in odp_flow_key_to_flow__(). Simplify (a && b) || (!a && c) to just a ? b : c. Signed-off-by: Ben Pfaff --- 21e70add7e5fc18c519ca3d46691230bf136b1e1 diff --git a/lib/odp-util.c b/lib/odp-util.c index b10f72e1e..873e05aea 100644 --- a/lib/odp-util.c +++ b/lib/odp-util.c @@ -3217,8 +3217,9 @@ odp_flow_key_to_flow__(const struct nlattr *key, size_t key_len, return ODP_FIT_ERROR; } - if ((is_mask && (src_flow->vlan_tci & htons(VLAN_CFI))) || - (!is_mask && src_flow->dl_type == htons(ETH_TYPE_VLAN))) { + if (is_mask + ? (src_flow->vlan_tci & htons(VLAN_CFI)) != 0 + : src_flow->dl_type == htons(ETH_TYPE_VLAN)) { return parse_8021q_onward(attrs, present_attrs, out_of_range_attr, expected_attrs, flow, key, key_len, src_flow); }