[ovs-dev] [PATCH v4 2/9] flow: Avoid compile errors.

Joe Stringer joestringer at nicira.com
Wed Aug 12 21:38:04 UTC 2015


On 7 August 2015 at 16:57, Jarno Rajahalme <jrajahalme at nicira.com> wrote:
> GCC (4.7) sees too wide shifts when there are none, refactor to
> circumvent the false error.
>
> Signed-off-by: Jarno Rajahalme <jrajahalme at nicira.com>
> ---
>  lib/flow.c | 35 ++++++++++++++++++++++-------------
>  1 file changed, 22 insertions(+), 13 deletions(-)
>
> diff --git a/lib/flow.c b/lib/flow.c
> index af51aac..61d9bdf 100644
> --- a/lib/flow.c
> +++ b/lib/flow.c
> @@ -133,25 +133,34 @@ BUILD_MESSAGE("FLOW_WC_SEQ changed: miniflow_extract() will have runtime "
>  #endif
>
>  #define miniflow_set_map(MF, OFS)                                       \
> -    if ((OFS) < FLOW_TNL_U64S) {                                        \
> -        MINIFLOW_ASSERT(!(MF.maps.tnl_map & (UINT64_MAX << (OFS)))      \
> +{                                                                       \
> +    size_t ofs = (OFS);                                                 \
> +                                                                        \

Being a bit pedantic here, but don't we usually use 'size_t' to
indicate a length in bytes? Seems like 'unsigned int' would be more
appropriate for bit-shifting.

Acked-by: Joe Stringer <joestringer at nicira.com>



More information about the dev mailing list