From owner-freebsd-hackers@FreeBSD.ORG Mon Nov 22 16:27:29 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8370C1065670 for ; Mon, 22 Nov 2010 16:27:29 +0000 (UTC) (envelope-from bruce@cran.org.uk) Received: from muon.cran.org.uk (muon.cran.org.uk [IPv6:2a01:348:0:15:5d59:5c40:0:1]) by mx1.freebsd.org (Postfix) with ESMTP id 215C38FC17 for ; Mon, 22 Nov 2010 16:27:29 +0000 (UTC) Received: from muon.cran.org.uk (localhost [127.0.0.1]) by muon.cran.org.uk (Postfix) with ESMTP id 301B8E7217 for ; Mon, 22 Nov 2010 16:27:28 +0000 (GMT) Received: from core.draftnet (client-86-27-20-161.glfd.adsl.virginmedia.com [86.27.20.161]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by muon.cran.org.uk (Postfix) with ESMTPSA for ; Mon, 22 Nov 2010 16:27:27 +0000 (GMT) Date: Mon, 22 Nov 2010 16:27:12 +0000 From: Bruce Cran To: freebsd-hackers@freebsd.org Message-ID: <20101122162712.3c3655fe@core.draftnet> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.22.1; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Logical vs. bitwise AND in sbin/routed/parms.c X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2010 16:27:29 -0000 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? 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