use || instead of | in logical expressions
PATCH 1/1 use || instead of | in logical expressions
Bit OR ('|') is probably faster and it always works correctly (but '&' doesn't!), but it looks horrible here.
Signed-off-by Alexander Potashev <[email protected]>
--- builtin-apply.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
builtin-apply.c +1 -1
@@ -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)
Signature · 1 line
1.6.0.6
Quoted 2 lines · Alexander Potashev
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.
Quoted 22 lines
Signed-off-by Alexander Potashev <[email protected]>--- builtin-apply.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)builtin-apply.c +1
-1@@ -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)Signature · 1 line
1.6.0.6