Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Nov 2010 18:35:23 +0000
From:      Alexander Best <arundel@freebsd.org>
To:        Bruce Cran <bruce@cran.org.uk>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Logical vs. bitwise AND in sbin/routed/parms.c
Message-ID:  <20101122183523.GA28412@freebsd.org>
In-Reply-To: <20101122162712.3c3655fe@core.draftnet>
References:  <20101122162712.3c3655fe@core.draftnet>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon Nov 22 10, Bruce Cran wrote:
> I've been going through src/bin and src/sbin seeing how easy it would
> be to remove warnings clang generates. During the work I came
> across routed/parms.c which appears to be doing a logical instead of
> bitwise AND. Would the following change be correct?

looking good. i also found some occurences of logical AND, although bitwise
AND would have been better. the changes got committed in [1].

cheers.
alex

[1] http://svn.freebsd.org/changeset/base/213318

> 
> Index: /usr/src/head/sbin/routed/parms.c
> ===================================================================
> --- /usr/src/head/sbin/routed/parms.c   (revision 215671)
> +++ /usr/src/head/sbin/routed/parms.c   (working copy)
> @@ -876,11 +876,11 @@
>                 if ((0 != (new->parm_int_state & GROUP_IS_SOL_OUT)
>                      && 0 != (parmp->parm_int_state & GROUP_IS_SOL_OUT)
>                      && 0 != ((new->parm_int_state ^
> parmp->parm_int_state)
> -                             && GROUP_IS_SOL_OUT))
> +                             & GROUP_IS_SOL_OUT))
>                     || (0 != (new->parm_int_state & GROUP_IS_ADV_OUT)
>                         && 0 != (parmp->parm_int_state &
> GROUP_IS_ADV_OUT) && 0 != ((new->parm_int_state ^ parmp->parm_int_state)
> -                                && GROUP_IS_ADV_OUT))
> +                                & GROUP_IS_ADV_OUT))
>                     || (new->parm_rdisc_pref != 0
>                         && parmp->parm_rdisc_pref != 0
>                         && new->parm_rdisc_pref !=
>                         parmp->parm_rdisc_pref)
> 
> -- 
> Bruce Cran

-- 
a13x



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101122183523.GA28412>