Simplify (a && b) || (!a && c) to just a ? b : c.

Signed-off-by: Ben Pfaff <[email protected]>
---
 lib/odp-util.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/odp-util.c b/lib/odp-util.c
index 515b531..cb27980 100644
--- a/lib/odp-util.c
+++ b/lib/odp-util.c
@@ -3213,8 +3213,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);
     }
-- 
1.7.10.4

_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to