Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Jan 2017 12:56:53 -0700
From:      Ian Lepore <ian@freebsd.org>
To:        Adrian Chadd <adrian@FreeBSD.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r312236 - head/sys/net80211
Message-ID:  <1484510213.86335.110.camel@freebsd.org>
In-Reply-To: <201701151949.v0FJnl2h027169@repo.freebsd.org>
References:  <201701151949.v0FJnl2h027169@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, 2017-01-15 at 19:49 +0000, Adrian Chadd wrote:
> Author: adrian
> Date: Sun Jan 15 19:49:47 2017
> New Revision: 312236
> URL: https://svnweb.freebsd.org/changeset/base/312236
> 
> Log:
>   [net80211] add some more "is this XXX" macros for CTRL and DATA.
>   
>   There's already a macro for MGT.
> 
> Modified:
>   head/sys/net80211/ieee80211.h
> 
> Modified: head/sys/net80211/ieee80211.h
> =====================================================================
> =========
> --- head/sys/net80211/ieee80211.h	Sun Jan 15 18:00:45 2017	
> (r312235)
> +++ head/sys/net80211/ieee80211.h	Sun Jan 15 19:49:47 2017	
> (r312236)
> @@ -165,6 +165,12 @@ struct ieee80211_qosframe_addr4 {
>  #define	IEEE80211_IS_MGMT(wh)					
> \
>  	(!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK)		
> \
>  	    == IEEE80211_FC0_TYPE_MGT))
> +#define	IEEE80211_IS_CTL(wh)					
> \
> +	(!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK)		
> \
> +	    == IEEE80211_FC0_TYPE_CTL))
> +#define	IEEE80211_IS_DATA(wh)					
> \
> +	(!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK)		
> \
> +	    == IEEE80211_FC0_TYPE_DATA))
>  
>  #define	IEEE80211_FC0_QOSDATA \
>  	(IEEE80211_FC0_TYPE_DATA|IEEE80211_FC0_SUBTYPE_QOS|IEEE80211
> _FC0_VERSION_0)
> 

What is the point of the !! in these macros?  The expressions already
have boolean type (even in C++ where it matters) due to the ==.
 Removing the !! would also make one level of parens redundant.

-- Ian



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