odp-util: Simplify logic in odp_flow_key_to_flow__().
authorBen Pfaff <blp@nicira.com>
Tue, 31 Dec 2013 18:36:19 +0000 (10:36 -0800)
committerBen Pfaff <blp@nicira.com>
Tue, 31 Dec 2013 19:42:52 +0000 (11:42 -0800)
Simplify (a && b) || (!a && c) to just a ? b : c.

Signed-off-by: Ben Pfaff <blp@nicira.com>
lib/odp-util.c

index b10f72e..873e05a 100644 (file)
@@ -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);
     }