From: Alexander Potashev <aspotashev@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] use || instead of | in logical expressions
Date: Fri, 2 Jan 2009 02:07:46 +0300 [thread overview]
Message-ID: <20090101230746.GA17008@myhost> (raw)
In-Reply-To: <20090101223953.GA16680@myhost>
On 01:39 Fri 02 Jan , Alexander Potashev wrote:
> Bit OR ('|') is probably faster and it always works correctly (but '&'
> doesn't!), but it looks horrible here.
Sorry, I was wrong: '&' would work as well (for example in expression
'(a < 1) & (b == 5)') because logical operators can return only 0 or 1.
>
> Signed-off-by: Alexander Potashev <aspotashev@gmail.com>
> ---
> builtin-apply.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/builtin-apply.c b/builtin-apply.c
> index 07244b0..c71afa1 100644
> --- a/builtin-apply.c
> +++ b/builtin-apply.c
> @@ -2487,7 +2487,7 @@ static int check_patch(struct patch *patch)
> ok_if_exists = 0;
>
> if (new_name &&
> - ((0 < patch->is_new) | (0 < patch->is_rename) | patch->is_copy)) {
> + (0 < patch->is_new || 0 < patch->is_rename || patch->is_copy)) {
> if (check_index &&
> cache_name_pos(new_name, strlen(new_name)) >= 0 &&
> !ok_if_exists)
> --
> 1.6.0.6
>
prev parent reply other threads:[~2009-01-01 23:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-01 22:39 [PATCH] use || instead of | in logical expressions Alexander Potashev
2009-01-01 23:07 ` Alexander Potashev [this message]
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=20090101230746.GA17008@myhost \
--to=aspotashev@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).