[PATCH] Wrap the DEBUG checks in a "unlikely"

Jeremy Allison jra at samba.org
Fri Dec 28 06:41:21 GMT 2007


On Fri, Dec 28, 2007 at 07:51:08AM +0100, Stefan (metze) Metzmacher wrote:
> >  #define DEBUGADDC( dbgc_class, level, body ) \
> >    (void)( ((level) <= MAX_DEBUG_LEVEL) && \
> > -          ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))||  \
> > +          unlikely((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))||  \
> >             (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \
> >              DEBUGLEVEL_CLASS[ DBGC_ALL   ] >= (level))  ) \
> >         && (dbgtext body) )
> 
> wouldn't it make sense to put the whole logic into the unlikely?
> 
>     (void)(unlikely( ((level) <= MAX_DEBUG_LEVEL) && \
>             ((DEBUGLEVEL_CLASS[ dbgc_class ] >= (level))||  \
>              (!DEBUGLEVEL_CLASS_ISSET[ dbgc_class ] && \
>               DEBUGLEVEL_CLASS[ DBGC_ALL   ] >= (level)) )) \
>            && (dbgtest body) )

I also think the unlikely macro should be moved into
include/includes.h for more general use.

Jeremy.


More information about the samba-technical mailing list