From: Florian Westphal <fw@strlen.de>
To: Gao Feng <fgao@ikuai8.com>
Cc: Florian Westphal <fw@strlen.de>,
Pablo Neira Ayuso <pablo@netfilter.org>,
Netfilter Developer Mailing List
<netfilter-devel@vger.kernel.org>
Subject: Re: [PATCH nf-next] netfilter: xt_nfacct: Use not operation instead of condition check
Date: Tue, 27 Sep 2016 02:39:24 +0200 [thread overview]
Message-ID: <20160927003924.GC17426@breakpoint.cc> (raw)
In-Reply-To: <CA+6hz4qxwzV7YME8Nzo-uTJH9n7jz8cO8GWd4P-5GV90Httyqg@mail.gmail.com>
Gao Feng <fgao@ikuai8.com> wrote:
> >> diff --git a/net/netfilter/xt_nfacct.c b/net/netfilter/xt_nfacct.c
> >> index cf32759..7abb5b5 100644
> >> --- a/net/netfilter/xt_nfacct.c
> >> +++ b/net/netfilter/xt_nfacct.c
> >> @@ -28,7 +28,7 @@ static bool nfacct_mt(const struct sk_buff *skb, struct xt_action_param *par)
> >>
> >> overquota = nfnl_acct_overquota(par->net, skb, info->nfacct);
> >>
> >> - return overquota == NFACCT_UNDERQUOTA ? false : true;
> >> + return !(overquota == NFACCT_UNDERQUOTA);
> >
> > I don't find one better than the other. If you need to change
> > it for some reason consider
> >
> > "return overquota != NFACCT_UNDERQUOTA"
> >
> > instead of this strange negation.
>
> Thanks, it is more simple use "!=".
> >
> > But really, I think its fine as-is.
>
> It could decrease one condition check and jump.
gcc should emit same instructions for all these variants.
next prev parent reply other threads:[~2016-09-27 0:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-26 14:13 [PATCH nf-next] netfilter: xt_nfacct: Use not operation instead of condition check fgao
2016-09-26 15:17 ` Florian Westphal
2016-09-27 0:36 ` Gao Feng
2016-09-27 0:39 ` Florian Westphal [this message]
2016-09-27 1:04 ` Gao Feng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160927003924.GC17426@breakpoint.cc \
--to=fw@strlen.de \
--cc=fgao@ikuai8.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.