[ovs-dev] [PATCH 3/3] odp-util: Simplify logic in odp_flow_key_to_flow__().

Andy Zhou azhou at nicira.com
Tue Dec 31 19:41:52 UTC 2013


LGTM.


On Tue, Dec 31, 2013 at 10:45 AM, Ben Pfaff <blp at nicira.com> wrote:

> Simplify (a && b) || (!a && c) to just a ? b : c.
>
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
>  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 3227e69..aff6c95 100644
> --- a/lib/odp-util.c
> +++ b/lib/odp-util.c
> @@ -3144,8 +3144,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
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20131231/19bca318/attachment-0003.html>


More information about the dev mailing list