Logical vs. bitwise AND in sbin/routed/parms.c

Alexander Best arundel at freebsd.org
Mon Nov 22 18:35:23 UTC 2010


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


More information about the freebsd-hackers mailing list