{"thread":{"id":"16955","subject":"[PATCH] use || instead of | in logical expressions","startedAt":"2009-01-01T22:39:53Z","lastAt":"2009-01-01T23:07:46Z","messageCount":2,"participants":["Alexander Potashev"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"99123","messageId":"20090101223953.GA16680@myhost","threadId":"16955","inReplyTo":null,"subject":"[PATCH] use || instead of | in logical expressions","fromName":"Alexander Potashev","fromEmail":"aspotashev@gmail.com","sentAt":"2009-01-01T22:39:53Z","receivedAt":"2009-01-01T22:39:53Z","isPatch":true,"sender":{"key":"aspotashev@gmail.com","avatar":null},"body":"Bit OR ('|') is probably faster and it always works correctly (but '&'\ndoesn't!), but it looks horrible here.\n\nSigned-off-by: Alexander Potashev <aspotashev@gmail.com>\n---\n builtin-apply.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-apply.c b/builtin-apply.c\nindex 07244b0..c71afa1 100644\n--- a/builtin-apply.c\n+++ b/builtin-apply.c\n@@ -2487,7 +2487,7 @@ static int check_patch(struct patch *patch)\n \t\tok_if_exists = 0;\n \n \tif (new_name &&\n-\t    ((0 < patch->is_new) | (0 < patch->is_rename) | patch->is_copy)) {\n+\t    (0 < patch->is_new || 0 < patch->is_rename || patch->is_copy)) {\n \t\tif (check_index &&\n \t\t    cache_name_pos(new_name, strlen(new_name)) >= 0 &&\n \t\t    !ok_if_exists)\n-- \n1.6.0.6\n"},{"id":"99125","messageId":"20090101230746.GA17008@myhost","threadId":"16955","inReplyTo":"20090101223953.GA16680@myhost","subject":"Re: [PATCH] use || instead of | in logical expressions","fromName":"Alexander Potashev","fromEmail":"aspotashev@gmail.com","sentAt":"2009-01-01T23:07:46Z","receivedAt":"2009-01-01T23:07:46Z","isPatch":true,"sender":{"key":"aspotashev@gmail.com","avatar":null},"body":"On 01:39 Fri 02 Jan     , Alexander Potashev wrote:\n> Bit OR ('|') is probably faster and it always works correctly (but '&'\n> doesn't!), but it looks horrible here.\n\nSorry, I was wrong: '&' would work as well (for example in expression\n'(a < 1) & (b == 5)') because logical operators can return only 0 or 1.\n\n> \n> Signed-off-by: Alexander Potashev <aspotashev@gmail.com>\n> ---\n>  builtin-apply.c |    2 +-\n>  1 files changed, 1 insertions(+), 1 deletions(-)\n> \n> diff --git a/builtin-apply.c b/builtin-apply.c\n> index 07244b0..c71afa1 100644\n> --- a/builtin-apply.c\n> +++ b/builtin-apply.c\n> @@ -2487,7 +2487,7 @@ static int check_patch(struct patch *patch)\n>  \t\tok_if_exists = 0;\n>  \n>  \tif (new_name &&\n> -\t    ((0 < patch->is_new) | (0 < patch->is_rename) | patch->is_copy)) {\n> +\t    (0 < patch->is_new || 0 < patch->is_rename || patch->is_copy)) {\n>  \t\tif (check_index &&\n>  \t\t    cache_name_pos(new_name, strlen(new_name)) >= 0 &&\n>  \t\t    !ok_if_exists)\n> -- \n> 1.6.0.6\n> \n"}]}